This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(d) { | |
var dl = d.createElement('a'); | |
dl.innerText = 'Download MP3'; | |
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1]; | |
dl.download = d.querySelector('em').innerText+".mp3"; | |
d.querySelector('.primary').appendChild(dl); | |
dl.style.marginLeft = '10px'; | |
dl.style.color = 'red'; | |
dl.style.fontWeight = 700; | |
})(document); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window = {} unless window? | |
global.$=require('jquery') unless jQuery? | |
global._=require('underscore') unless _? | |
global.Backbone=require('backbone') unless Backbone? | |
global.Mustache=require('../lib/mustache') unless Mustache? | |
global.localStorage=require('localStorage') unless localStorage? | |
global.Store=require('../lib/backbone.localStorage') unless Store? | |
global.jsdom = require("jsdom").jsdom | |
global.document = jsdom('<html><body></body></html>') | |
global.window = document.createWindow() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: node app.js | |
worker: node consumer.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
control = require 'control' | |
task = control.task | |
perform = control.perform | |
task 'staging', 'config got my server', -> | |
config = user: 'root' | |
addresses = ['socketchat.co.uk'] | |
return control.hosts(config, addresses) | |
task 'deploy', 'deploy the latest version of the app', (host) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shuffle items front and back to flow infinitely | |
infiniteFlow: () => | |
last = $("#{@config.id} section.item:last-child") | |
first = $("#{@config.id} section.item:first-child") | |
outer = $('.items') | |
if last.hasClass('right') or last.hasClass('current') | |
oldLeft = outer.position().left | |
width = first.width() | |
newLeft = oldLeft + width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = [ | |
"dog" | |
"cat" | |
"fish" | |
] | |
randomize = -> return (Math.round(Math.random())-0.5) | |
random = array.sort randomize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startTime = new Date().getTime() | |
onLoadEventHandler = () -> | |
latency = startTime - performance.timing.navigationStart | |
console.log 'Latency = ' + latency + 'ms' | |
onLoadEventHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { | |
if(!window.your_bookmarklet) { | |
var doc = document, | |
js = doc.createElement('script'); | |
js.type = 'text/javascript'; | |
js.src = 'loader.js'; | |
js.async = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$('#post_message').keyup(function() { | |
var content_length = $(this).val().length; | |
var remaining = 420 - content_length | |
$('.counter').html(remaining); | |
if (remaining < 0) { | |
$('input[type=submit]').attr("disabled", "disabled"); | |
} else if (remaining < 21 && remaining > 9) { | |
$('input[type=submit]').removeAttr("disabled"); | |
$('.counter').removeClass('red'); |