Skip to content

Instantly share code, notes, and snippets.

@benbjohnson
benbjohnson / gist:540610
Created August 20, 2010 16:12
CI Joe Error for RVM 1.9.2
$ cijoe -p 4000 .
/Users/benbjohnson/.rvm/gems/ruby-1.9.1-p378/gems/choice-0.1.4/lib/choice/parser.rb:108: warning: Hash#index is deprecated; use Hash#key
sh: line 0: cd: [/path/to/repo]: No such file or directory
sh: line 0: cd: [/path/to/repo]: No such file or directory
== Sinatra/1.0 has taken the stage on 4000 for development with backup from WEBrick
[2010-08-20 10:10:11] INFO WEBrick 1.3.1
[2010-08-20 10:10:11] INFO ruby 1.9.1 (2010-01-10) [i386-darwin9.8.0]
[2010-08-20 10:10:11] INFO WEBrick::HTTPServer#start: pid=72029 port=4000
@benbjohnson
benbjohnson / EmbedExample.as
Created December 10, 2010 21:38
Pure AS3 Text File Embed
package
{
import flash.display.Sprite;
import flash.text.TextField;
[SWF(width="800", height="600")]
public class EmbedExample extends Sprite
{
public function EmbedExample()
{
@benbjohnson
benbjohnson / AsyncCallbackTest.as
Created December 14, 2010 19:10
Async Callback Test
public function shouldTestCallbackMethod():void
{
// Create a dispatcher that lives outside your callback
var dispatcher:EventDispatcher = new EventDispatcher();
// Create your callback mock function which dispatches the event
var func:Function = function():void{
dispatcher.dispatchEvent(new Event(Event.COMPLETE));
}
@benbjohnson
benbjohnson / MyASFont.as
Created February 16, 2011 18:50
Flex vs AS3 Font Embedding
package
{
import flash.text.Font;
// This will not generate any ActionScript!
[Embed(source="MyFont.otf", fontFamily="myFont", mimeType='application/x-font')]
public class MyFont extends Font
{
public function MyFont()
{
@benbjohnson
benbjohnson / github_lang.txt
Created March 5, 2011 18:29
GitHub Languages in Order of Popularity
1. JavaScript
2. Ruby
3. Python
4. Perl
5. C
6. PHP
7. Shell
8. Java
9. C++
10. VimL
@benbjohnson
benbjohnson / top_github_lang.rb
Created March 5, 2011 20:26
Queries for the Languages on GitHub by Popularity
#!/usr/bin/ruby
require 'rubygems'
require 'mechanize'
mechanize = Mechanize.new
rankings = {}
# Retrieve language list
mechanize.get("https://github.com/languages") do |page|
@benbjohnson
benbjohnson / basic-2.mkn
Created August 2, 2011 18:25
Mockdown Documentation
%canvas width="100" height="100" border="1px #000000" background="#FF0000"
%canvas width="50%" height="20" background="#00FF00"
%canvas width="20" height="20" vcenter="0" hcenter="0" background="#0000FF"
@benbjohnson
benbjohnson / basic-6.mkn
Created August 4, 2011 16:59
Mockdown Documentation 2
%canvas width="100" height="100" border="1px #000000" background="#FF0000"
%my-component selected="true" first-name="Bob" hcenter="0" vcenter="0"
%border width="100%" height="100%" background="#999999"
%border width="100%" height="100%" background="#666666"
%border width="100%" height="100%" background="#333333"
.my-named-yield=
%border background="#0000FF"
@benbjohnson
benbjohnson / queue.feature
Created June 19, 2012 18:13
Keen Queue Feature
Scenario Outline: Add events to queue
Given a Keen Client using <type>
When I post <n> events
Then the size of the queue should have gone up by <n>.
Examples:
| type | n |
| flat_file | 5 |
| flat_file | 20 |
| redis | 5 |
@benbjohnson
benbjohnson / msgpack_spec.md
Created July 9, 2012 22:59
MessagePack Format Specification

Fixnums

positive fixnum

Save an integer within the range [0, 127] in 1 bytes.

+--------+
|0XXXXXXX|
+--------+