Skip to content

Instantly share code, notes, and snippets.

# helpers for local :javascripts and :stylesheets
# add
# yield :javascripts
# yield :stylesheets
# in your header
def load_javascripts(*scripts)
load_content(:javascripts,*scripts) do |script|
javascript_include_tag script
end
@elisehuard
elisehuard / gist:333827
Created March 16, 2010 10:30
awesome wm and rubymine
# add in .zshrc or .bashrc
# or in rubymine's startup script :)
export AWT_TOOLKIT='MToolkit java -jar weka.jar'
static VALUE
ossl_x509req_add_unstructuredName(VALUE self, VALUE name)
{
X509_REQ *req;
char* s;
GetX509Req(self,req);
s = StringValuePtr(name);
if (X509_REQ_add1_attr_by_NID(req, NID_pkcs9_unstructuredName,MBSTRING_ASC,s, -1) != 1) {
ossl_raise(eX509ReqError,NULL);
def post(method_name, options = {}, body = nil)
request_body = body.blank? ? encode : body
if new?
# connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers)
# elise fix
connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers).tap do |response|
.id self= id_from_response(response)
load_attributes_from_response(response)
end
self
gem install hanna
@elisehuard
elisehuard / lark_template.rb
Created August 21, 2009 13:58
removing states and metric-fu for rails rumble
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"