Skip to content

Instantly share code, notes, and snippets.

View DAddYE's full-sized avatar

Davide D'Agostino DAddYE

  • Uber
  • San Francisco
View GitHub Profile
@matz
matz / gist:3066997
Created July 7, 2012 16:00
code to migrate between 2 mrb_state
#include "mruby.h"
#include "mruby/string.h"
#include "mruby/array.h"
mrb_value
migrate_simple_value(mrb_state *mrb, mrb_value v, mrb_state *mrb2)
{
mrb_value nv; /* new value */
const char *s;
int len;
@lomereiter
lomereiter / Makefile
Created April 8, 2012 14:55
howto: d & ruby ffi
test: test_c.o test_d.o
cc -shared -m32 test_c.o test_d.o -o test.so -lphobos2
test_c.o: test.c
gcc -c -m32 test.c -o test_c.o
test_d.o: test.d
dmd -c -m32 test.d -oftest_d.o
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

require 'sinatra/base'
require 'ostruct'
dummy = OpenStruct.new :template_cache => Tilt::Cache.new, :settings => Sinatra::Base
dummy.extend Sinatra::Templates
puts dummy.markdown('# hi')
@nesquena
nesquena / upgrade.md
Created July 28, 2011 05:43
Upgrade to Lion
@b0c1
b0c1 / gist:1037593
Created June 21, 2011 10:41
Padrino multi role monkey patch
#put into the padrino boot.rb file before Padrino.load!
module Padrino
module Admin
module AccessControl
class Base
##
# Return an array of project_modules
#
def project_modules(account)
roles = account.roles if account.roles.kind_of?(Array) rescue []
" Search for mkdCode and throw this in there where you like...I did on line 72
syn region mkdCode start=/^``[^`]*/ end=/[^`]*``.*/
@bernerdschaefer
bernerdschaefer / gist:962715
Created May 9, 2011 15:19
some bash helpers for working with padrino projects
alias rake="time rake"
# Run `padrino rake` when inside a padrino project,
# otherwise run the normal rake command.
function rake () {
if [[ -f ".components" ]]; then
padrino rake $*
else
ruby -S rake $*
fi
@nesquena
nesquena / killmatch
Created April 6, 2011 02:52
Kills all processes matching a pattern (killmatch)
# !/usr/bin/env ruby
# USAGE
# sudo killmatch Rails
unless ARGV[0]
puts "Specify a pattern to kill! i.e killmatch Rails"
exit
end
@quackingduck
quackingduck / app.rb
Created February 12, 2011 10:55
A one-file MacRuby app
#!/usr/bin/env macruby
framework 'AppKit'
# Inspired by: http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html
# Inits NSApp
NSApplication.sharedApplication
# Allows an app without an applicaiton bundle or info.plist to still be an app