Skip to content

Instantly share code, notes, and snippets.

View cixing.rb
# library that can conjugate any Mandarin verb
module Cixing
def self.conjugate(verb)
verb
end
end
View note.rb
#!/usr/bin/env ruby
require "rubygems"
require "fuzzy_match"
def find_match(str, opts = {})
notes = {}
Dir["#{ENV["HOME"]}/Dropbox/notes/**/*"].select { |n| n =~ /\./ }.each do |path|
key = path.split("Dropbox/notes/")[1]
@joeyschoblaska
joeyschoblaska / tm
Last active Jan 9, 2018
Bash script to either create or attach to a named tmux session with the given working directory.
View tm
#!/bin/bash
if [ "$1" != "" ]; then
cd $1
fi
DIR_NAME=${PWD##*/}
tmux has-session -t $DIR_NAME 2>/dev/null
if [ $? -eq 1 ]
View openings.csv
ECO Count Name PGN
A40 2,160,508 Queen Pawn Opening 1.d4
B00 1,398,214 King's Pawn 1.e4
C20 1,050,507 King Pawn Game 1.e4 e5
B20 955,201 Sicilian Defense 1.e4 c5
D00 661,940 Queen Pawn Game 1.d4 d5
A45 651,186 Indian Game 1.d4 Nf6
C44 571,079 King's Knight Opening: Normal Variation 1.e4 e5 2.Nf3 Nc6
C40 532,194 King's Knight Opening 1.e4 e5 2.Nf3
B50 517,282 Sicilian Defense: Modern Variations 1.e4 c5 2.Nf3 d6
@joeyschoblaska
joeyschoblaska / text_cats
Last active Mar 7, 2017
An example of the "text/cats" content-type.
View text_cats
$ curl -v "http://api.groupon.com/v2/deals/nori-chicago-2.cats?client_id=21a3dda11309f0db69bdbefddda4a9625a66cd77"
< HTTP/1.1 200 OK
< Content-Type: text/cats; charset=utf-8
{"de
al":{"
tipped
At":"2
View webpack.config.js
var debug = process.env.NODE_ENV !== "production";
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: [
"./js/main.js",
"./styles/application.scss",
View karabiner.xml
<?xml version="1.0"?>
<!--
Tap CAPS for ESC, hold CAPS + hjkl for Vim movement.
Open "System Preferences > Keyboard > Modifier Keys..." and change caps lock configuration to "No Action"
Use Seil to remap caps to F19 (80)
-->
<root>
@joeyschoblaska
joeyschoblaska / chess_fen.py
Created Mar 11, 2012
Chess FEN plugin for Anki, modified to display the board from black's perspective if it is his turn to move: http://uucode.com/blog/2011/06/27/chess-fen-plugin-for-anki/
View chess_fen.py
# chess fen
# Anki plugin to generate chess diagramms
# ===========================================================
#
# The plugin converts "fen" tag to a corresponding image.
#
# The original text:
#
# :: Do you like this position?
# :: [fen]rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1[/fen]
@joeyschoblaska
joeyschoblaska / craigslist.rake
Last active Dec 16, 2015
A rake task to scan Craigslist periodically and email any new listings that match a set of parameters.
View craigslist.rake
require 'open-uri'
def in_bounds?(lat, lng)
bounds = [
{:north => 41.87849, :east => -87.623917, :south => 41.872041, :west => -87.633787}
]
bounds.any?{|b| lat >= b[:south] && lat <= b[:north] && lng <= b[:east] && lng >= b[:west]}
end
View spec_age.rb
require "date"
specs = []
def get_indentation(line)
line.match(/^(\s*)/)[1].length
end
File.open(ENV["FILE"]) do |file|
spec = nil