Skip to content

Instantly share code, notes, and snippets.

View jmettraux's full-sized avatar

John Mettraux jmettraux

View GitHub Profile

#Tools Engineer

CrowdFlower is funded, growing, and, frankly, where the action is at in San Francisco. As our client base continues to grow, we need you to make sure their projects go smoothly.

Skills that are a must

Startup: You're able to learn quickly, design creative solutions, and work independently.

People: As a tools engineer you’ll work with lots of people—both technical and non-technical.

@tomash
tomash / metal.rb
Created October 21, 2010 13:28
Metal Lorem Ipsum preview
# Returns a randomly generated sentence of lorem ipsum text.
# The first word is capitalized, and the sentence ends in either a period or
# question mark. Commas are added at random.
def sentence
# Determine the number of comma-separated sections and number of words in
# each section for this sentence.
sections = []
1.upto(rand(5)+1) do
sections << (WORDS.sort_by{rand}.slice(0...(rand(9)+3)).join(" "))
@peterc
peterc / webloc.rb
Created January 26, 2011 04:19
Basic Ruby code to read and write ".webloc" files (as used on OS X)
# Basic Ruby code to read and write ".webloc" files (as used on OS X)
# Reads both "old" Safari style and newer plist style
# Writes "old" style only
# Works on Ruby 1.9.2 and 1.8.7
require 'plist'
class Webloc
attr_accessor :url
require 'rubygems'
require 'ruote'
require 'flexmock'
require 'spec'
# Workitem fields validation
# This participant validates the fields of the current workitem
# Especially useful to validate the initial workitem
# An input definition may include the following:
# - name: Input name, compulsory
@heisters
heisters / .vimrc
Created March 31, 2011 16:52
my vimrc
set nocompatible " We're running Vim, not Vi!
set hidden
set title
set list
set listchars=tab:»·,trail:·
"set ai sw=2 sts=2 et
set t_Co=256 " lots of colors
set incsearch
syntax on
set scrolloff=2 " make it scroll before I hit the edge
@coffeeaddict
coffeeaddict / ruote-setup.md
Created July 18, 2012 17:43
For mister_solo, as a reply to a question on #ruote (freenode irc)

Setup

This is my ruote / ruote-kit setup in non Rails project

A Project Module

I tend to have a Project Module for my non-web projects; so that instead of calling Rails.logger I call Project.logger (Where Project would be the actual name, Such as Fubar or SameOld) same goes for ruote. It mostly ends-up in Project.engine where the code would look something like this:

@rsms
rsms / gist:3564654
Created September 1, 2012 05:33
Life is purposeless. And it is beautiful that it is purposeless

Life is purposeless. And it is beautiful that it is purposeless

It is very difficult, particularly for the Western mind, to understand that life is purposeless. And it is beautiful that it is purposeless. If it is purposeful then the whole thing becomes absurd – then who will decide the purpose? Then some God has to be conceived who decides the purpose, and then human beings become just puppets; then no freedom is possible. And if there is some purpose then life becomes businesslike, it cannot be ecstatic.

The West has been thinking in terms of purpose, but the East has been thinking in terms of purposelessness. The East says life is not a business, it is a play. And a play has no purpose really, it is nonpurposeful. Or you can say play is its own purpose, to play is enough. Life is not reaching towards some goal, life itself is the goal. It is not evolving towards some ultimate; this very moment, here and now, life is ultimate.

Life as it is, is accepted in the East. It is not moving towards some end, b

@caruccio
caruccio / bash-path-vars
Last active December 28, 2023 22:47
Path manipulation with bash vars
$ FILE=/some/path/to/file.txt
###################################
### Remove matching suffix pattern
###################################
$ echo ${FILE%.*} # remove ext
/some/path/to/file
$ FILE=/some/path/to/file.txt.jpg.gpg # note various file exts
@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@eddiemoore
eddiemoore / nric-validation.js
Last active October 17, 2022 05:39
Validation for Singapore NRIC and FIN number
//Based on http://www.samliew.com/icval/
function validateNRIC(str) {
if (str.length != 9)
return false;
str = str.toUpperCase();
var i,
icArray = [];
for(i = 0; i < 9; i++) {