Skip to content

Instantly share code, notes, and snippets.

View jeremyckahn's full-sized avatar

Jeremy Kahn jeremyckahn

View GitHub Profile
@tdreyno
tdreyno / equivs.txt
Created September 12, 2011 00:51 — forked from jeremyckahn/equivs.txt
Equivalent JS and CoffeeScript functions?
getSpeedySignature: (ofString) ->
sum = 0
for i in [0..ofString.length]
sum += ofString.charCodeAt(i)
sum
@millermedeiros
millermedeiros / .vimrc
Last active December 11, 2023 14:44
My VIM settings (.vimrc)
" =============================================================================
" Miller Medeiros .vimrc file
" -----------------------------------------------------------------------------
" heavily inspired by: @factorylabs, @scrooloose, @nvie, @gf3, @bit-theory, ...
" =============================================================================
" -----------------------------------------------------------------------------
" BEHAVIOR

I click a link in Facebook or Twitter, I don't care about the URL. I care about content.

Sure, that link points to a URL, but I don't know what it is, and I'll never remember it. It could even be a really sensible URL, like http://odopod.com/blog/hack-days-2011-coming-november/ — but I still won't remember it. URLs are implementation details for content on the web, not content in themselves.

People want to share. They're probably doing it with Facebook or Twitter. Being able to share a link to content isn't dependent on a native or non-native experience, it's neutral. Even if your native app had a URL bar, you wouldn't want to copy and paste that into a thing and send that thing to someone, you want to press share and press a person.

Look, I love web apps — I even build one for a living! But users consistently appreciate native apps on iPhone (this doesn't apply to Android) because of the constraints of the HIG and the SDK.

@blake8086
blake8086 / twitter.js
Created November 17, 2011 23:13
Simple node.js server to stream Twitter 'Spritzer' level stream to client browser
global.server = require('http').createServer(function(request, response) {
global.twitterFeed = require('https').get({
auth: 'username:password',
host: 'stream.twitter.com',
path: '/1/statuses/sample.json',
}, function(res) {
res.setEncoding('utf8');
response.writeHead(200, 'text/plain');
res.on('data', function(chunk) {
response.write(chunk);
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@marcel
marcel / gist:2100703
Created March 19, 2012 07:24
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
@madrobby
madrobby / webkitRequestAnimationFrame.html
Created April 5, 2012 06:40 — forked from jeremyckahn/webkitRequestAnimationFrame.html
An example of requestAnimationFrame (webkit version)
<b id=a>X<script>e=document.getElementById('a'),i=0;(function u(){e.style.marginLeft=++i+'px';webkitRequestAnimationFrame(u)})()</script>​
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@millermedeiros
millermedeiros / build.js
Created May 9, 2012 01:15
sample node.js build script including RequireJS optimizer (r.js) and copy/delete/filter files
// Combine JS and CSS files
// ---
//
// Make sure you install the npm dependencies
// > cd YOUR_PROJECT_FOLDER
// > npm install
//
// Than run:
// > node build