Skip to content

Instantly share code, notes, and snippets.

View hallettj's full-sized avatar

Jesse Hallett hallettj

View GitHub Profile
Hello, world!
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
# My bash prompt. Displays the currently checked out git
# branch and the exit status of the last command.
#
# This is adapted from various sources, including colors
# from Lifehacker and exit status and git branch indicators
# from Igal Koshevoy <http://gist.github.com/109520>.
#
# To use copy and paste this code into your .bashrc file.
function prompt {
...
Loading package cgi-3001.1.7.1 ... linking ... done.
Loading package ansi-terminal-0.5.0 ... linking ... done.
Loading package ansi-wl-pprint-0.5.0 ... linking ... done.
[24 of 25] Compiling Hack.Contrib.Middleware.Lucky ( src/Hack/Contrib/Middleware/Lucky.hs, dist/build/Hack/Contrib/Middleware/Lucky.o )
[25 of 25] Compiling Hack.Contrib.Middleware.ShowStatus ( src/Hack/Contrib/Middleware/ShowStatus.hs, dist/build/Hack/Contrib/Middleware/ShowStatus.o )
src/Hack/Contrib/Middleware/ShowStatus.hs:56:53:
Couldn't match expected type `String -> String'
against inferred type `[Char]'
# Command to transcode HD video for upload to Vimeo. This assumes that the video started with appropriate dimensions and frame rate.
ffmpeg -i bdd.MP4 -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 5000k -bt 5000k -g 30 -threads 0 -y -f null /dev/null && ffmpeg -i bdd.MP4 -acodec libfaac -ab 128k -pass 2 -vcodec libx264 -vpre hq -b 5000k -bt 5000k -g 30 -threads 0 -y -f mp4 bdd.prepared.mp4
<!-- This is an example of how to make cross site Ajax requests using the new
W3C Access Control API described at:
https://developer.mozilla.org/En/HTTP_Access_Control
This is the client-side implementation. Use the cs_xhr and cs_load functions to
perform cross-site Ajax requests. -->
<!doctype html>
<html>
<head>
-- Defines a data type, `Length a`, with different constructors to represent
-- different units of length. Comparisons and arithmetic can be performed with
-- this type and mismatched units are converted automatically.
--
-- For example,
--
-- Feet 3 + Meters 1 => Meters 1.9146341463414633
data Length = Meters Double | Kilometers Double | Feet Double | Miles Double
require 'couch_foo'
## Setup code. Put this in an initializer to set up a database connection.
CouchFoo::Base.set_database(:host => "http://localhost:5984",
:database => "couch_foo_example")
# Uncomment this line if you are using Rails
#CouchFoo::Base.logger = Rails.logger
-- Performing calculations on measurements of length using Haskell types. The
-- winning solution created collaboratively at @pdxfunc.
--
-- August 10, 2009
--
-- When arithmetic is performed on mixed length units, the result will be
-- measured with the smallest unit in the expression.
--
-- Usage:
--
Ideas for node.js projects
============================
* simple twitter client
* file server
* streaming music server
* simple wiki
* which kitten is saddest?