sudo yum -y update
cd /opt
sudo wget -c http://download.virtualbox.org/virtualbox/4.3.4/VBoxGuestAdditions_4.3.4.iso -O VBoxGuestAdditions_4.3.4.iso
sudo mount VBoxGuestAdditions_4.3.4.iso -o loop /mnt
cd /mnt
sudo sh VBoxLinuxAdditions.run --nox11
cd /opt
sudo rm *.iso
sudo /etc/init.d/vboxadd setup
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
// check if value is an integer | |
function isInt(value){ | |
return Number(value) === value && value % 1 === 0; | |
} | |
// function to flatten an array | |
function flatten(data, isInteger) { | |
var result = []; | |
// initialize data if input is undefined/empty |
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
# A simple alarm for mac users. | |
# Usage: | |
# Paste this code in ~/.irbrc | |
# $ irb | |
# > alarm 10, "Noodles are ready!" | |
# > alarm 10, "Lunch at Marks", "Good" | |
# > alarm 10, "Go to the bank!", "Bad" | |
def alarm(minutes, message, voice = "Alex") | |
Thread.new do | |
sleep(60*minutes) |
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 self.update_migration | |
all.each do |u| | |
begin | |
u.partner_id = Partner.first(:conditions => {name: u.partner_name}) | |
Timeline.all(:conditions => {user_id: u.pretty_id}).each do |t| | |
t.user_id = u.id | |
u.favorite_ids = [] | |
t.user_ids = [] | |
t.save |
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
upstream dather { | |
server unix:/srv/dather.com/shared/pids/unicorn.sock; | |
} | |
server { | |
server_name dather.com *.partners.dather.com; | |
access_log /var/log/nginx/dather.com-access.log; | |
root /srv/dather.com/current/public; |
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
Ruote.process_definition do | |
sequence do | |
my_participant :name => 'x', :ptimeout => '10d', :reminder => '9d' | |
end | |
# ... | |
define 'my_participant' do |
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 'formula' | |
class Libffi < Formula | |
url 'http://mirrors.kernel.org/sources.redhat.com/libffi/libffi-3.0.9.tar.gz' | |
mirror 'ftp://sourceware.org/pub/libffi/libffi-3.0.9.tar.gz' | |
homepage 'http://sourceware.org/libffi/' | |
sha1 '56e41f87780e09d06d279690e53d4ea2c371ea88' | |
keg_only :provided_by_osx, "Guile uses this version of libffi." |
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 bid_ids | |
key[:bids].zrange(0, -1) | |
end | |
def bids | |
bid_ids.map { |id| Bid[id] } | |
end | |
def add_bid(bid) | |
key[:bids].zadd(bid.value, bid.id) |
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
Cuba.define do | |
on "apis" do | |
on "speech" do | |
on root do | |
render("speech", title: "Speech API") | |
end | |
on "docs" do | |
render("docs", title: "Speech API Documentation") | |
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
$("#search").keydown(function(e) { | |
var $resultsUl = $("#suggested-result"); | |
var $currentSelection = $resultsUl.find("li.highlighted:visible"); | |
if ($currentSelection.length == 0) return; | |
if (e.keyCode == 40) { // keyCode 40 == down | |
var $next = $currentSelection.next(); | |
if ($next.length > 0) { |
OlderNewer