Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

View winton's full-sized avatar

Winton Welsh winton

  • Los Angeles, CA
View GitHub Profile
let alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("")
let base = alphabet.length
function decode(code) {
let c, i
i = 0
for (let j = 0, len = code.length; j < len; j++) {
c = code[j]
i = i * base + alphabet.indexOf(c)
}
[{
"id": 1,
"value": {
"text": '{"text":"Inverse is fueling the next generation of dreamers and doers by reporting the wonder of the world in a new light.", "cta":"Get stories that spark curiosity sent straight to your inbox."}',
"widget": "50-nick-lucchesi"
}
},
{
"id": 2,
"value": {
@winton
winton / scripts.coffee
Last active August 29, 2015 14:18
Gulp task to compile and browserify a client coffeescript
gulp = require "gulp"
browserify = require "browserify"
coffee = require "gulp-coffee"
transform = require "vinyl-transform"
gulp.task "coffee", ->
gulp
.src "./app/scripts/**/*.coffee"
.pipe coffee bare: true
.pipe gulp.dest("./dist/lib")
@winton
winton / gist:4057862
Created November 12, 2012 06:49
Starting point for playing with Promises/when.js
When = require('when')
x = ->
d = When.defer()
#d.resolve('hello')
d.reject('hello')
d.promise
console.log ""
# DELETE AFTER USING
desc "Rename project"
task :rename do
name = ENV['NAME'] || File.basename(Dir.pwd)
camelize = lambda do |str|
str.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
end
dir = Dir['**/gem_template*']
begin
from = dir.pop
function getParams() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
backup:
backup_itunes:
music:
source: ~/Music/iTunes/iTunes Music/Music
destination: /Volumes/untitled/iTunes
delete: false
itunes_tv:
source: ~/Music/iTunes/iTunes Music/TV Shows
destination: /Volumes/untitled/iTunes
delete: false
def rsync
puts `rbackup #{ARGV.first}`
end
rsynced_at = nil
rsync
while true
modified = `find #{File.dirname(__FILE__)}/breport #{File.dirname(__FILE__)}/../active/a_b -mmin -1`.split("\n")
modified.delete_if { |m| m.include?('.git') }
LDFLAGS="-arch x86_64" ./configure --prefix=/usr/local/sphinx --with-mysql=/usr/local/mysql
Status: 500 Internal Server Error
can't dump anonymous class Class
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:6:in `to_yaml'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:110:in `node_export'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:110:in `add'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:110:in `to_yaml'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:109:in `each'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:109:in `to_yaml'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:108:in `seq'
/usr/lib64/ruby/1.8/yaml/rubytypes.rb:108:in `to_yaml'