Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If your workers are inactive for a long period of time, they'll lose | |
| # their MySQL connection. | |
| # | |
| # This hack ensures we re-connect whenever a connection is | |
| # lost. Because, really. why not? | |
| # | |
| # Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
| # | |
| # From: | |
| # http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -e | |
| # | |
| # Usage: browser | |
| # pipe html to a browser | |
| # e.g. | |
| # $ echo '<h1>hi mom!</h1>' | browser | |
| # $ ron -5 man/rip.5.ron | browser | |
| if [ -t 0 ]; then | |
| if [ -n "$1" ]; then |
This is now an actual repo:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Open GitHub page for the current repository. | |
| # | |
| # Example: | |
| # $ git clone https://github.com/majek/puka.git | |
| # $ cd puka | |
| # $ gh_open # Browser: https://github.com/majek/puka | |
| function gh_open { | |
| open $(git config remote.origin.url | ruby -ne 'puts "https://" + $_.split(%r{[/:@]})[1..-1].join("/").sub(/\.git$/, "")') | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import urllib2 | |
| gh_url = 'https://api.github.com' | |
| req = urllib2.Request(gh_url) | |
| password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h2>Using YQL to Finance quotes</h2> | |
| <?php | |
| $BASE_URL = "https://query.yahooapis.com/v1/public/yql"; | |
| // Form YQL query and build URI to YQL Web service | |
| $yql_query = "select * from yahoo.finance.quotes where symbol in ('YHOO', 'APPL')"; | |
| $yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&env=store://datatables.org/alltableswithkeys&format=json"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Named constants with unique integer values | |
| var C = {}; | |
| // Tokenizer States | |
| var START = C.START = 0x11; | |
| var TRUE1 = C.TRUE1 = 0x21; | |
| var TRUE2 = C.TRUE2 = 0x22; | |
| var TRUE3 = C.TRUE3 = 0x23; | |
| var FALSE1 = C.FALSE1 = 0x31; | |
| var FALSE2 = C.FALSE2 = 0x32; | |
| var FALSE3 = C.FALSE3 = 0x33; |
OlderNewer