Skip to content

Instantly share code, notes, and snippets.

@simon-lang
simon-lang / spinnnnn.js
Created February 3, 2014 04:59
spinnnnn.js
$('body').css('-webkit-transition', '-webkit-transform 0.8s');
i=0;
setInterval(function(){
i += 360
$('body').css("-webkit-transform","rotate("+ i +"deg)")}
,800)
@simon-lang
simon-lang / getting started with cordova.sh
Created February 7, 2014 01:52
getting started with cordova.sh
sudo npm install -g cordova
npm install -g ios-sim
npm install -g ios-deploy
cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add ios
cordova build
cordova emulate ios
cordova run ios
@simon-lang
simon-lang / record signals.coffee
Created February 18, 2014 05:21
record signals.coffee
if window.recordSignals
@recorded ?= []
@recorded.push {signal, cb}
window.playbackSignals = ->
i = 0
window.recordSignals = false
for item, i in devApp.scraper.recorded then do (item, i) ->
{signal, cb} = item
setTimeout ->
@simon-lang
simon-lang / list gists.coffee
Created February 20, 2014 00:36
list gists.coffee
$.ajax(url: "https://api.github.com/users/captainclam/gists").done (gists) ->
$('.public-gists').empty()
for gist in gists then do (gist) ->
{id, description, html_url, created_at} = gist
a = $('<a>')
a.attr 'href', html_url
a.text description
li = $ '<li>'
li.append created_at.substr(0, 10) + ': '
li.append a
@simon-lang
simon-lang / ios simulator inspector brah.scpt
Last active August 29, 2015 13:56
ios simulator inspector brah
on alfred_script(q)
tell application "Safari"
activate
delay 0.5
tell application "System Events"
tell process "Safari"
set frontmost to true
try
click menu item 2 of menu 1 of menu item "iOS Simulator" of menu 1 of menu bar item "Develop" of menu bar 1
end try
@simon-lang
simon-lang / js2coffee directory
Created April 6, 2014 23:42
js2coffee directory
find . -type f -name '*.js' | while read f; do echo "grinding $f to ${f/.js/.coffee} "; js2coffee "$f" > "${f/.js/.coffee}"; done
find . -type f -name '*.js' | while read f; do echo "deleting $f "; rm $f; do
exports.Router = Backbone.Router.extend
routes:
'home': 'home'
'login': 'login'
'profile': 'profile'
'logout': 'logout'
'search/:query': 'search'
home: ->
console.log 'router:home'
@simon-lang
simon-lang / ugh.coffee
Created June 6, 2014 03:30
ugh.coffee
link = $('<link>')
link.attr
href: $('#cdn').val() + '/casino/' + $('#shortName').val() + '/stylesheets/main.css'
rel: 'stylesheet'
id: 'mainStylesheet'
$('head').append link
@simon-lang
simon-lang / basic-persistence.coffee
Created June 8, 2014 00:23
basic-persistence.coffee
# text, select
$('input[type=text].persist').each ->
id = $(this).attr('id')
val = localStorage.getItem(id)
$(this).val(val)
$('input[type=text].persist').change ->
id = $(this).attr('id')
val = $(this).val()
localStorage.setItem(id, val)
@simon-lang
simon-lang / basic-localStorage.coffee
Created June 8, 2014 23:45
basic-localStorage.coffee
retrieve = (k) -> JSON.parse localStorage.getItem k
store = (k, v) -> localStorage.setItem k, JSON.stringify v
store 'name', 'simon'
store 'age', 28
store 'list', [1, 2, 3]
store 'happy', true
console.log retrieve 'list'