Skip to content

Instantly share code, notes, and snippets.

View tjbrennan's full-sized avatar

Taylor Brennan tjbrennan

  • San Francisco, CA
View GitHub Profile
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active November 2, 2024 12:56
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
@bentruyman
bentruyman / Custom.css
Created August 17, 2011 00:30
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

lxe's javascript style guide.

Can be applied to C as well.

Focus on the first 3 headings.

1. Consistency

Keep things consistent. Don't vary your indent, spacing, braces, etc... across lines, files and project.

2. Readability

Make sure your code is easy on the eyes. If you're supposedly showing someone what your code does, line by line, make sure they aren't struggling to follow it.

@tupakapoor
tupakapoor / newbranch.sh
Last active December 22, 2015 11:38
A script to make creating a new branch from the most up to date version of upstream/master easier
#!/bin/bash
if [ -z "$1" ]; then
echo usage: newbranch newbranchname oldbranchtoclonefrom
exit
fi
git remote -v | grep upstream > /dev/null
if [ $? -ne 0 ]; then
echo You must have a remote named upstream
@marianposaceanu
marianposaceanu / linux_fun.md
Last active January 29, 2023 20:31
How to have some fun using the terminal.

Linux fun-o-matic

How to have some fun using the terminal.

  1. Install cowsay [0] via : sudo apt-get install cowsay
  2. Install fortune [1] via : sudo apt-get install fortune
  3. Make sure you have Ruby installed via : ruby -v
  4. Install the lolcat [2] via : gem gem install lolcat
  5. Profit!
@lxe
lxe / ludicrousspeed.sh
Last active December 29, 2015 00:39
ludicrousspeed.sh
#!/bin/bash
# Some tweaks to OSX tcp/fd setting
# to ease load testing
#
# Disclaimer: I have no idea what i'm doing
#
# Descrease port hold time
@debasishg
debasishg / gist:8172796
Last active November 11, 2024 07:10
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
// Long-polling chat server + client.
var chats = [];
require('http').createServer(function(req, res) {
if (/\/c/.test(req.url)) return res.end(chats.join('\n'));
var m = req.url.split('=');
if (m.length > 1) chats.unshift(m[1].replace(/\+/g, ' '));
res.end('<html><body><form><input name="m"></form><pre></pre><script>'
+ 'var r=new XMLHttpRequest;(function e(){r.open("GET","/c",true);r.send();r.onreadystatechange=function(){if(r.readyState==4){document.getElementsByTagName("pre")[0].innerHTML=r.responseText;setTimeout(e,1e3)}}})();document.forms[0].m.focus()'
+ '</script></body></html>')
}).listen(parseInt(process.env.PORT, 10)|| 3000);