Skip to content

Instantly share code, notes, and snippets.

View fd's full-sized avatar
🏳️‍🌈
Unstoppable

Simon Menke fd

🏳️‍🌈
Unstoppable
View GitHub Profile
@fd
fd / output.txt
Created May 24, 2011 13:56
yajl-ruby parser bug.
(in /Users/Simon/Projects/json_select/t)
FF
Failures:
1) Parser should not swallow the first object after parsing a number(integer)
Failure/Error: ]
expected: ["foo", "bar", 42, "baz", "bax"]
got: ["foo", "bar", 42, "bax"] (using ==)
Diff:
@fd
fd / not_super.rb
Created May 12, 2011 14:42
call a superclass method without `super`
class A
def foo
puts "bar #{self.class}"
end
end
class B < A
def foo
puts "baz #{self.class}"
end
/*
* Curry a JS function.
*
* Note:
* Curry doesn't change `this`.
*
* Example:
* function f(a, b, c){
* return [a, b, c];
* };
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://simonmenke.me/chains.js/build/jquery.stacks.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
(function(exports){
exports.state_machine = function(def){
@fd
fd / jquery.viewport.js
Created September 30, 2010 14:55
jQuery plugin for getting elements above, in or below the viewport
(function($){
$.fn.viewportState = (function(){
var results = [];
this.each(function(){
var bounds = this.getBoundingClientRect();
if (window.viewport.height() < bounds.top) {
results.push(['below', $(this)]);
} else if (bounds.bottom <= 0) {
results.push(['above', $(this)]);
} else {
@fd
fd / _notes.md
Created July 30, 2010 12:09
Embedding Dylan in Rails 3.x

Embedding Dylan in Rails 3.x

Embedding Dylan in Rails 3.x is easy:

  • Create file called app/dylan/blog.rb
  • Create a template app/views/blog/index.html.erb
  • Mount Blog in the router.
@fd
fd / gisty.xml
Created November 13, 2009 12:53
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Gisty" height="120">
<Require feature="wave" />
</ModulePrefs>
<Content type="html">
<![CDATA[
<div id="form_div"><input type="text" value="" id="gist_id" /> <input type=button value="Click Me!" id="butCount" onClick="buttonClicked()" /></div>
<div id="content_div"><script src="GIST_URI"></script></div>
<script type="text/javascript">
require 'rubygems'
module Rack #:nodoc:
class GemAssets
F = ::File
# :assets_dir:: the sub directory where we will look for assets. (default: <tt>public</tt>)
# :xsendfile:: use XSendfile to send files.(default: <tt>true</tt>)
def initialize(app, options={})
FailtaleReporter.configure do |config|
config.base_uri 'failtale.be'
config.api_token '[[your projects api token here]]'
end
sudo gem sources -a http://gems.github.com
sudo gem install mrhenry-failtale-reporter