Skip to content

Instantly share code, notes, and snippets.

View buley's full-sized avatar
🤑

Tay buley

🤑
View GitHub Profile
@alloy
alloy / status_bar_view.rb
Created March 30, 2011 09:10
A MacRuby example of a custom view in the status bar, with selection highlight.
class StatusBarView < NSView
attr_reader :progressIndicator, :statusBarItem
def initWithStatusBarItem(item)
bar = item.statusBar
if initWithFrame([[0,0], [bar.thickness, bar.thickness]])
@statusBarItem = item
@highlight = false
origin, size = frame.origin, frame.size
@funkatron
funkatron / twitter-oauth-pin.html
Created May 19, 2011 01:06
A simple example of PIN-based oauth flow with Twitter and jsOAuth
<!DOCTYPE html>
<html>
<head>
<!--
A simple example of PIN-based oauth flow with Twitter and jsOAuth.
This is mostly based on/copied from <http://log.coffeesounds.com/oauth-and-pin-based-authorization-in-javascri>.
Get jsOAuth at <https://github.com/bytespider/jsOAuth/downloads>
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@francois2metz
francois2metz / indextank.js
Created June 13, 2011 16:48
indextank with Node and Spore
// mkdir indextank
// wget https://github.com/SPORE/api-description/blob/master/services/indextank.json
// install node and npm
// npm install spore underscore futures
// edit baseUrl, password and index var
// node indextank.js
var baseUrl = 'http://xxx.api.indextank.com';
var password = 'xxx';
var index = 'test_spore';
@greenido
greenido / IndexDB-demo3.html
Created June 24, 2011 22:34
IndexDB demo for MDC day (Chrome 12+ and FF4+)
<!DOCTYPE html>
<html>
<head>
<title>IndexDB Demo - Version 1.1</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="author" content="Ido Green"/>
</head>
<style>
#footer {
background-color: yellowgreen;
@burin
burin / each_with_index.coffee
Created June 27, 2011 14:33
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
Handlebars.registerHelper 'each_with_index', (array, fn) ->
buffer = ''
for i in array
item = i
item.index = _i
buffer += fn(item)
buffer
@dbamber
dbamber / test.js
Created September 13, 2011 21:06
Testing GOogle document api support for tables
/*
* Author: David Bamber <dbamber@gmail.com>
* http://bmbr.co
*
* Usage: node test.js -u <googleuser> -p <googlepass>
* node test.js -u <googleuser> -p <googlepass> -regex -url /feeds/default/private/full
*
* Optional Fags:
* -url [url]: requests a different uri from docs api, defaults to /feeds/default/private/full/-/table
* -regex: applies a regex to try and sanitize output
javascript:void(window.open("","dp_debugger","width=600,height=600,location=0,menubar=0,status=1,toolbar=0,resizable=1,scrollbars=1").document.write("<script language=\"JavaScript\" id=dbg src=\"http://www.digitalpulse.omniture.com/dp/debugger.js\"></"+"script>"));
@dmitry
dmitry / gist:1296732
Created October 18, 2011 21:09
Creating a Backbone.js View Manager
/**
Big thanks to Derick Bailey for his post here:
http://lostechies.com/derickbailey/2011/09/15/zombies-run-managing-page-transitions-in-backbone-apps/
*/
(function(Account) {
/** LOTS OF MODEL, COLLECTION, AND VIEW CREATION GOING ON UP HERE, LEFT IT OUT FOR SIMPLICITY */
/**
* Define Routing.
@felixge
felixge / command.sh
Created October 29, 2011 13:43
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me: