This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install hanna |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add in .zshrc or .bashrc | |
# or in rubymine's startup script :) | |
export AWT_TOOLKIT='MToolkit java -jar weka.jar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
module Nokogiri | |
module XML | |
class Node | |
BLANK = /^[ \n]*$/ | |
# Comparing with other node | |
# - same name | |
# - same attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(sieve). | |
-export([run/1]). | |
run(M) -> | |
Numbers = lists:seq(3, M), | |
Startpid = self(), | |
spawn_link(fun() -> prime_filter(Startpid, 2, Numbers) end), | |
gather(). | |
gather() -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
type request struct { | |
data []int | |
replyChannel chan []int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zmq' | |
require 'json' | |
handler_ctx = ZMQ::Context.new(1) | |
# receive and response for mongrel2 handlers | |
# queue address corresponds to what's in the configuration | |
recv_queue = handler_ctx.socket(ZMQ::PULL) | |
recv_queue.connect("tcp://127.0.0.1:9999") |
OlderNewer