Skip to content

Instantly share code, notes, and snippets.

class HaveWant
attr_reader :answers
def initialize(*have, want)
@have = have[0]
@args = have[1..-1]
@want = want
find_matches
class JourneyCoffeeGenerator < Journey::Visitors::Visitor
def accept node
@requirements = [[]]
super.gsub('" + "', '')
end
private
def visit_GROUP node
@requirements << []
@nowhereman
nowhereman / plural_inflections.rb
Created February 11, 2013 20:02
Returns all inflections matching rules for plural form
# Returns all inflections matching rules for plural form
plural_inflections = ActiveSupport::Inflector.inflections.instance_variable_get("@singulars").map { |i| i[0] }.concat(ActiveSupport::Inflector.inflections.instance_variable_get("@uncountables"))
# Extend jQuery objects with Underscore collection methods.
#
# Each collection method comes in two flavors: one prefixed
# with _, which yields a bare DOM element, and one prefixed
# with $, which yields a jQuery-wrapped element.
#
# So if `this` is a jQuery object, instead of:
#
# _.max @, (el) -> $(el).height()
#
@nowhereman
nowhereman / Object_tap.html
Last active June 11, 2016 21:27
Object#tap in JavaScript
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Object#tap in JavaScript</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://sugarjs.com/javascripts/sugar-0.9.5.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
(function($) {
@nowhereman
nowhereman / combo.legacy.user.js
Created August 5, 2011 15:57
Transform all select tag, legacy behaviour of https://gist.github.com/954934
// ==UserScript==
// @name Pimp my Drop Down List
// @description Instant auto-completion for any drop down lists (<select>) on any page
// @author Nowhere Man
// @version 0.2.9dev
// @homepage https://gist.github.com/954934/#file_readme.md
// @updateURL https://raw.github.com/gist/954934/combo.user.js
// @include https://*
// @include http://*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
@nowhereman
nowhereman / bookmark-helper.js
Created July 23, 2011 08:34 — forked from balupton/bookmark-helper.js
History.js It! A bookmark for trialing History.js on your own website.
(function(window,undefined){
// Load Helpers
var
intervalScript, intervalJquery,
loadScript = function(scriptUrl){
var e = document.createElement('script');
e.setAttribute('src',scriptUrl);
window.document.body.appendChild(e);
return e;
@nowhereman
nowhereman / README.md
Created May 4, 2011 08:36
Pimp my Drop Down List, instant autocompletion on demand for any <select> drop down lists on any page (Comb'O jQuery plugin for Greasemonkey).

Pimp my Drop Down List

Instant auto-completion on demand for any <select> drop down lists on any page. With the help of [jQuery Comb'O plugin][combo.js].

Prerequisites

  • [Mozilla Firefox][firefox] with [Scriptish][scriptish](recommended) or [Greasemonkey][greasemonkey] extension.
@nowhereman
nowhereman / jsTreeWithSearchPlugin.js
Created September 6, 2010 08:57
Transform jsTree Search plugin into a Live Search
// To transform jsTree Search plugin (http://www.jstree.com/documentation/search)
// Into a live Filter/Search system, like http://ejohn.org/blog/jquery-livesearch
// TODO Add a QuickSilver/LiquidMetal support, maybe with the help of jsTree sort plugin
//$("div.jstree li").show(); // Clear search
$("div.jstree li").hide();
$("div.jstree li a[class=jstree-search]").parents("div.jstree li").show();