Skip to content

Instantly share code, notes, and snippets.

@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

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@robhawkes
robhawkes / twitter.js
Created August 12, 2011 10:58
Twitter scraper in Node
// Reorder, rename, and document variables at some point
var sys = require("sys"),
twitter = require("ntwitter"),
mongoose = require("mongoose"),
db_user,
db_pass,
db_url,
db_port,
db_name,
coll,
@codeincontext
codeincontext / gist:1189597
Created September 2, 2011 19:24
mixing two audioboos with <audio>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
// file://localhost/Users/skattyadz/code/audio/index.htm?boo1=157217&boo2=3113
$(document).ready(function(){
var audio1 = document.createElement('audio');
var audio2 = document.createElement('audio');
audio1.volume=0.5;
@artero
artero / launch_sublime_from_terminal.markdown
Last active January 25, 2024 16:57 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@mklabs
mklabs / bootstrap-plugins.txt
Created December 2, 2011 11:23
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
@RonnyO
RonnyO / localive.js
Last active September 30, 2015 21:58
Conditional loading of live.js for dev environments
// Load live.js on local envs only
// Make sure the path is right and your dev env passes the test.
/* Delete these characters to disable it temporarily -> */
(function() {
if(/^https?:\/\/(localhost|127.0.0.1)|^file:\/\/\//.test(document.location.href)) {
var live = document.createElement('script');
live.src = 'js/live.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(live, s);

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@bengourley
bengourley / gist:2152795
Created March 21, 2012 21:00
Setting up OS X from scratch

Setting up my fresh OS X install from scratch:

  • Install xcode (once installed go to Xcode->Preferences->Components to download command line tools, then sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ to point to things like opendiff)
  • Install purchased apps from AppStore
  • Install Dropbox
  • Install Chrome, Firefox
  • Install brew
  • brew install git
  • brew install mongo
  • mkdir -p /data/db sudo chgrp admin /data/db sudo chmod g+w /data/db
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/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
#