SSH into Root
$ ssh root@123.123.123.123
Add Deploy User
require "rubygems" | |
require "json" | |
require "net/http" | |
require "uri" | |
uri = URI.parse("http://api.bitcoinaverage.com/exchanges/USD") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) |
SSH into Root
$ ssh root@123.123.123.123
Add Deploy User
# Sample implementation of quicksort and mergesort in ruby | |
# Both algorithm sort in O(n * lg(n)) time | |
# Quicksort works inplace, where mergesort works in a new array | |
def quicksort(array, from=0, to=nil) | |
if to == nil | |
# Sort the whole array, by default | |
to = array.count - 1 | |
end |
require 'benchmark/ips' | |
require 'ohm' | |
require 'dm-core' | |
require 'dm-redis-adapter' | |
Ohm.redis = Redic.new("redis://127.0.0.1:6379") | |
DataMapper.setup(:default, {:adapter => "redis"}) | |
class DMUser | |
include DataMapper::Resource |
$(document).ready -> | |
Dropzone.autoDiscover = false | |
$(document).on 'shown.bs.modal', '.upload-modal', -> | |
modal = this | |
previewTemplate = $('#' + modal.id + ' .dz-file-preview')[0].innerHTML | |
# Make sure to only initialize the dropzone once. | |
if ( $('#' + modal.id + ' .dropzone:not(.dz-attached)').length ) | |
dropzone = new Dropzone('#' + modal.id + ' .dropzone', { |
# Create a promise: | |
myCoolPromise = new Promise (resolve, reject) -> | |
# do a thing | |
success = true | |
if success | |
resolve 'stuff worked' | |
else | |
reject Error 'it broke' |