Skip to content

Instantly share code, notes, and snippets.

View joemccann's full-sized avatar
💭
Thinking

Joe McCann joemccann

💭
Thinking
View GitHub Profile
@chmouel
chmouel / upload-to-rackspace-cloud-file.sh
Created June 9, 2010 18:53
Upload to RackSpace CloudFiles from shell with curl.
#!/bin/bash
# Author: Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
# Not officially supported by Rackspace only as a best effort basis :)
# Define yes to make it to copy to url to clipboard (via a shortened url
# service) You need to have the software xclip installed in your system.
COPY_URL_TO_CLIPBOARD=yes
# Containers to ignore in the list
CONTAINERS_TO_IGNORE=".CDN_ACCESS_LOGS"
var input = document.getElementById('myfileinput');
var files = input.files;
var file = files[i];
var xhr = new XMLHttpRequest();
xhr.open('post', '/path/to/destination', true);
xhr.onreadystatechange = function() {
if (this.readyState != 4) { return; }
// request finished - handle response
};
@mattdenner
mattdenner / card.css
Created August 11, 2010 10:10
How to do backface hiding when -webkit-backface-visibility doesn't work!
/*
The back of the card is rotated 180 degrees from the card itself, giving
the illusion that it really is the back! Unfortunately hiding the back
face of both "faces" doesn't work with webkit builds (requires Snow Leopard!)
but we set it anyway.
*/
.card #back { -webkit-transform: rotateY(180deg); }
.card .face { -webkit-backface-visibility: hidden; }
/*
module.exports = tree
tree.sync = treeSync
var fs = require("fs")
, path = require("path")
function tree (root, cb) {
fs.lstat(root, function (er, s) {
if (er) return cb(er)
s.name = root
@jeffrafter
jeffrafter / server.js
Created August 28, 2010 21:37
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@tanepiper
tanepiper / twitter_oauth_getter.js
Created September 11, 2010 16:14
A small command line nodejs script for doing Twitter OAuth.
#!/usr/bin/env node
var argv = require('optimist')
.usage('Usage: --key=[consumer key] -secret=[consumer secret]')
.demand(['key', 'secret'])
.argv
;
var OAuth = require('oauth').OAuth;
var Step = require('step');
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
var express = require('express'),
request = require('request'),
BufferList = require('bufferlist').BufferList,
sys = require('sys');
var app = express.createServer(
express.logger(),
express.bodyDecoder()
);
@tmpvar
tmpvar / gist:608277
Created October 3, 2010 04:32
fun with json-command & notify-send
curl -d "track=nodejs,tmpvar,jsdom,carena,cider,conductor" http://stream.twitter.com/1/statuses/filter.json -uUSER:PASS 2> /dev/null | json text -C | while read line; do notify-send -c normal -t 1000 "twitter message" "$line"; done
@tmpvar
tmpvar / gist:608282
Created October 3, 2010 04:50
fun with growlnotify and json-command
curl -d "track=nodejs,tmpvar,jsdom,carena,cider,conductor" http://stream.twitter.com/1/statuses/filter.json -uUSER:PASS 2> /dev/null | json text -C | while read line; do growlnotify -m "$line"; done