Skip to content

Instantly share code, notes, and snippets.

View kattrali's full-sized avatar

Delisa kattrali

View GitHub Profile
@ryansobol
ryansobol / gist:5276501
Last active December 15, 2015 14:39
What Really Happened at #inspect 2013

What Really Happened at #inspect 2013

For those who couldn't make it to Brussels, here's what you missed.

Dispassionate objectivity

From my experience, great conferences have one thing in common -- debates during, in-between and after talks. #inspect 2013 was no different.

Most speakers had opinions on snake_case vs camelCase. I overheard arguments both for and against Teacup at lunch. Colleagues from around the globe weighed in on the benefits of wrappers and the pitfalls of additional dependencies. Even the venue for #inspect 2014 sparked a catch phrase -- "Tan or tech, Cancun or New York".

@mutewinter
mutewinter / Alfred 3 Workflows.md
Last active November 25, 2020 14:14
A list of Alfred 3 workflows I'm using.
@tarcieri
tarcieri / gist:5483325
Last active December 16, 2015 19:10
The DHH Drinking Game

The @dhh Drinking Game

Take a drink whenever @dhh:

  1. Drops the f-bomb (or says "shit")
  2. Makes fun of Java (or Struts, Hibernate, etc)
  3. Mentions "frameworks should be extractions, not inventions"
  4. Mentions "constraints are liberating"
  5. Defends TurboLinks or the asset pipeline
  6. Mentions Basecamp
@supermarin
supermarin / gist:5597771
Last active December 17, 2015 10:49
Testing asynchronous methods with Kiwi
//
// BeerTests.m
// Beer
//
// Created by Marin Usalj on 5/16/13.
// Copyright 2013 @mneorr | mneorr.com. All rights reserved.
//
#import "Kiwi.h"
@gusaaaaa
gusaaaaa / es5tricks.js
Last active May 9, 2016 14:39
ECMAScript 5.1 tricks
// one-liner to build a sequence of numbers
// source: http://ariya.ofilabs.com/2013/01/es6-and-array-comprehension.html
Array.apply(0, Array(3)).map(function(x, y) { return y }); // [0, 1, 2]
// one-liner to filter elements
// source: http://ariya.ofilabs.com/2013/01/es6-and-array-comprehension.html
[1,4,2,3,-8].filter(function(i) { return i < 3 }); // [1, 2, -8]
@elyezer
elyezer / ring_buffer.sql
Last active May 16, 2024 03:38
How to create a ring buffer table in SQLite
-- Example table
CREATE TABLE ring_buffer (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT);
-- Number 10 on where statement defines the ring buffer's size
CREATE TRIGGER delete_tail AFTER INSERT ON ring_buffer
BEGIN
DELETE FROM ring_buffer WHERE id%10=NEW.id%10 AND id!=NEW.id;
END;
@schickling
schickling / Rakefile
Last active December 3, 2024 22:57
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@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
@alloy
alloy / Rakefile
Last active March 23, 2016 10:36
A Rakefile that standardises program env installation and guides the user, as opposed to crashing with Ruby exceptions such as `LoadError`. The only case where this will *never* work reliably is if you use the `rubygems-bundler` (NOEXEC) plugin, which introduces chicken-and-egg problems.
# Do *not* load any libs here that are *not* part of Ruby’s standard-lib. Ever.
desc "Install all dependencies"
task :bootstrap do
if system('which bundle')
sh "bundle install"
sh "git submodule update --init"
# etc
else
$stderr.puts "\033[0;31m[!] Please install the bundler gem manually: $ [sudo] gem install bundler\e[0m"
@willrax
willrax / my_scene.rb
Last active August 29, 2015 14:01
Parallax scrolling with Sprite Kit and RubyMotion
# Video of it in action: http://cl.ly/VSIF
class MyScene < SKScene
def scroll_action(x, duration)
width = (x * 2)
move = SKAction.moveByX(-width, y: 0, duration: duration * width)
reset = SKAction.moveByX(width, y: 0, duration: 0)
SKAction.repeatActionForever(SKAction.sequence([move, reset]))
end