Skip to content

Instantly share code, notes, and snippets.

View oddlyzen's full-sized avatar
:electron:
Working with Electron

Mark Coates oddlyzen

:electron:
Working with Electron
View GitHub Profile
@oddlyzen
oddlyzen / snippet.rb
Created March 24, 2009 05:00 — forked from anonymous/snippet.rb
Interesting little brain fart.
def speed_bump(&block)
sleep(1)
yield
sleep(1)
end
[1:46am] <bitpimpin> !task Again.
[1:46am] <lurch_bot> A task ('Again.') was created at Tue Mar 24 01:46:41 -0400 2009. <ID:8957300>
[1:46am] <bitpimpin> !tag 8957300 test,this,out
[1:46am] <lurch_bot> Found object <8957300>:
[1:46am] <lurch_bot> Tagged! Test
[1:46am] <lurch_bot> Tagged! This
[1:46am] <lurch_bot> Tagged! Out
[1:47am] <bitpimpin> !tasks
[1:47am] <lurch_bot> <ID:8957300>(Again.): 27.233957 seconds | Tagged: test, this, out.
[1:47am] <bitpimpin> !tasks
# wadl.rb
# http://www.crummy.com/software/wadl.rb/
# Super cheap Ruby WADL client
# by Leonard Richardson leonardr@segfault.org
# v20070217
# For more on WADL, see http://wadl.dev.java.net/
require 'rubygems'
require 'rest-open-uri'
// (Excerpt from http://tinyurl.com/c4e47q)
// At this point, I'd like to take a moment to speak to you about the Adobe PSD format.
// PSD is not a good format. PSD is not even a bad format. Calling it such would be an
// insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having
// worked on this code for several weeks now, my hate for PSD has grown to a raging fire
// that burns with the fierce passion of a million suns.
// If there are two different ways of doing something, PSD will do both, in different
// places. It will then make up three more ways no sane human would think of, and do those
// too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide
// that *these* particular chunks should be aligned to four bytes, and that this alignement
Xzibit = Object clone do(
dawg = method(what,
"yo dawg" print.
what print.
"clone" print.
self
).
so_you_can = method(
"so you can print" print.
class HoboType::Cents < DelegateClass(Fixnum)
COLUMN_TYPE = :integer
HoboFields.register_type(:cents, self)
def initialize(value)
super(centsify value)
end
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
div.header {
padding: 0;
height: 100px;
}
div.header a.logo {
display: block;
width: 237px;
height: 43px;
background: url(img/logo.png) no-repeat;
<script>
// test for localStorage support
if(('localStorage' in window) && window['localStorage'] !== null){
var f = document.getElementById('mainform');
// test with Ruby if the form was sent (the submit button has the name "sent")
<% if params[:sent] %>
// get the HTML of the form and cache it in the property "state"
localStorage.setItem('state',f.innerHTML);
// if the form hasn't been sent...
<% else %>
#!/bin/sh
# Some fixes are from http://blog.segment7.net/articles/2006/03/02/fast-memcached-on-os-x
#
# AFTER RUNNING THIS SCRIPT:
#
# Set the environment variable EVENT_NOKQUEUE to 1
# * csh and derivatives: setenv EVENT_NOKQUEUE 1
# * sh and derivatives (like bash): export EVENT_NOKQUEUE=1
#