This file contains 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
select distinct t1.foo, t3.bar | |
from t1 | |
join t1t2 on t1.id = t1t2.id1 | |
left outer join t2 on t1t2.id2 = t2.id and (t2.expires > curdate() or t2.baz = 'qux') | |
join t2t3 on t2.id = t2t3.id2 | |
left outer join t3 on t2t3.id3 = t3.id and t3.quux = 'garply' and t3.waldo = 'fred' | |
where | |
t1.plugh = 'xyzzy' | |
limit 100; |
This file contains 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
elementYouCareAbout.ancestors().detect(function(element) {pos = window.getComputedStyle(element).position;return ((pos == 'relative') || (pos == 'absolute'))}) |
This file contains 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
def primes i | |
(3..i).to_a.each do |number_to_test| | |
primes << number_to_test if primes.take_while do |prime| | |
prime < Math.sqrt(n)}.none? {|p| n % prime == 0}} | |
end | |
end | |
end |
This file contains 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
def trace | |
def warn_or_log msg | |
if defined? Rails | |
logger.debug msg | |
else | |
warn msg | |
end | |
end | |
def debug |
This file contains 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
require 'set' | |
def newline_separated_file_to_set name | |
things = Set.new | |
File.open name do |f| | |
f.lines.each do |things| | |
things.add things.strip | |
end | |
end | |
things | |
end |
This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Data.Enumerator as E | |
import qualified Data.Enumerator.Internal as EI | |
import qualified Data.Enumerator.Binary as ET | |
import qualified Data.Enumerator.List as EL | |
import qualified Data.ByteString.Char8 as T | |
import Data.Char | |
import Data.Functor | |
import Control.Monad | |
import qualified Data.Text.Lazy as TL |
This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
import System.IO | |
import Control.Pipe | |
import Control.Monad | |
import Control.Monad.Trans.Class | |
import qualified Data.Text as S | |
import qualified Data.Text.IO as I | |
readFile' :: Handle -> Producer S.Text IO () | |
readFile' h = do |
This file contains 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
var http = require('http'); | |
var fs = require('fs'); | |
var requests = 1; | |
var concurrency = process.argv[4]; | |
var max_retries = 2; | |
var host = process.argv[2], | |
port = process.argv[3]; |
This file contains 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
1.9.2p180 :202 > Balanced::Marketplace.my_marketplace.credits[1].attributes | |
+--------------------+---------------------------------------------------------------------------------+ | |
| 0 | 1 | | |
+--------------------+---------------------------------------------------------------------------------+ | |
| account | #<Balanced::Account:0x007f8aaf049390> | | |
| fee | 0 | | |
| description | None | | |
| amount | 100 | | |
| created_at | 2012-11-03T23:45:25.948590Z | | |
| destination | #<Balanced::BankAccount:0x007f8aaf03e968> | |
This file contains 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
# config/initializers/source_maps.rb | |
if Rails.env.development? | |
require 'open3' | |
module CoffeeScript | |
class SourceMapError < StandardError; end; | |
class << self | |
def map_dir |
OlderNewer