Skip to content

Instantly share code, notes, and snippets.

@fj
fj / example.txt
Last active April 30, 2016 17:09
#####################################
# recipes.html
---
layout: showcase
title: Recipes
description: my favorite recipes
---
{% assign item_collection = site.recipes | sort: 'date_range' %}
#####################################
@fj
fj / letter-from-new-developer.md
Last active January 24, 2016 17:34
letter I received from a new developer

Hi John,

I am {name redacted}, a 4th year student @ {university in India}.

I was looking up for list reversal problem in stackoverflow and came across your solution. I liked the solution a lot and went ahead and checked out your profile on SO. Then I visited your linkedin profile and then I realized you are totally experienced developer.

I read ur summary( really loved ur philosophy on design!! simply awesome) and went through all your contributions to the developer world. I also visited all ur github repos and saw ur open source contributions. I really liked ur project awesomesauce although my javascript skill is not that proficient to understand most of your code.😁

@fj
fj / gist:8541477
Created January 21, 2014 14:51
Hypothetical pattern-matching API in Ruby.
(1..100).match do |i|
pattern(i%3, i%5) {
match [0, 0], "FizzBuzz" # match i%3 == 0, i%5 == 0
match [0, _], "Fizz" # match i%3 == 0, i%5 == anything
match [_, 0], "Buzz" # match i%3 == anything, i%5 == 0
}
end
# => [nil, nil, "Fizz", nil, "Buzz", "Fizz", ...]
@fj
fj / gist:8393399
Created January 13, 2014 01:50
SymSpell fast-spellcheck algorithm from faroo.com. Original here: http://blog.faroo.com/2012/06/24/1000x-faster-spelling-correction-source-code-released/
// SymSpell: 1000x faster through Symmetric Delete spelling correction algorithm
//
// The Symmetric Delete spelling correction algorithm reduces the complexity of edit candidate generation and dictionary lookup
// for a given Damerau-Levenshtein distance. It is three orders of magnitude faster and language independent.
// Opposite to other algorithms only deletes are required, no transposes + replaces + inserts.
// Transposes + replaces + inserts of the input term are transformed into deletes of the dictionary term.
// Replaces and inserts are expensive and language dependent: e.g. Chinese has 70,000 Unicode Han characters!
//
// Copyright (C) 2012 Wolf Garbe, FAROO Limited
// Version: 1.6
> class Naked; end
=> nil
> Naked.ancestors
=> [Naked, Object, Kernel, BasicObject]
> Naked.ancestors.count
=> 4
> require 'active_record'
alias.gl=log --format=format:"%C(yellow bold)%h%Creset @ %C(blue)%cd%C(reset) » %C(white)%s%C(reset) (%C(green)%cN%C(reset)) %+d" --topo-order --graph --date=iso
@fj
fj / happy_holidays.rb
Created December 12, 2013 19:17
Happy holidays from UpHex (http://uphex.com)! This snowflake is actually a (minimally) obfuscated Ruby program. Run with `ruby happy_holidays.rb`.
s="U1RET1VULnN5bmMgPSB0cnVlCmxldHRlcl9kZWxheSwgZnJhbWVfZGVsYXkgPSAwLjA4L
CAwLjA0CnMgPSAiSGFwcHkgSG9saWRheXMgZnJvbSBVcEhleCEiCm0gPSAld3ssIC4gOiAhI
F4 gK
yA qIDA gI
yB PI EB 9C
nU gPSAiI C I gKiAoc y5
za Xp lK Q o Kc HJ pb
nQ gIlx yIC Aje 3V9 XHI iOwoK eC
A9 I C V3 ey 0 g Ly
B8 IF x cfT sKe G wg PS
@fj
fj / gist:7621449
Created November 23, 2013 23:42
readthedocs.com erroring out
╭── jxf@tesseract · 2013-11-23 · 18:19:58
│ (master)
│ /home/jxf/src/projects/docker/docs
╰─▶ ψ curl -sL -w "%{http_code}\\n" http://readthedocs.com -o /dev/null
500
@fj
fj / gist:7605618
Created November 22, 2013 19:40
Hypothetical deployment YAML for hypothetical CMDB/deployment tool.
strategies:
# deployment mechanisms
-
name: ec2-production
# config for deploying to production
-
name: ec2-staging
# config for deploying to staging
-
name: vagrant-local-development
@fj
fj / output
Created November 12, 2013 01:12
╭── jxf@tesseract · 2013-11-11 · 20:11:34
│ ‹ruby:ruby-2.0.0-p247@›
│ (master *)
│ /home/jxf/src/projects/rspec-core
╰─▶ ψ bundle update
Updating git://github.com/rspec/rspec.git
Updating git://github.com/rspec/rspec-expectations.git
Updating git://github.com/rspec/rspec-mocks.git
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..