First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel
Then ssh with root account, run this in termianl:
$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash
def striped_box(x, y, w, h, spacing=10, border_extra={}, line_extra={}) | |
primitives = [] | |
border_box = { | |
x: x, | |
y: y, | |
w: w, | |
h: h, | |
} | |
primitives << border_box.merge(primitive_marker: :border).merge(border_extra) | |
top_corner_x = x |
instance.file_field.save(the_filename, file_content, save=False) | |
MyModel.objects.filter(id=instance.id).update(file_field=instance.file_field) |
context "making sure we don't accidentally take the site down" do | |
EXPECTED_NUMBER_OF_WORKERS = 10 # copy this value from the other place it's defined; this shouldn't be dynamic, repeating yourself is better | |
it "reminds the user of side effects" do | |
begin | |
expect(MySystem::NUMBER_OF_WORKERS).to eq(EXPECTED_NUMBER_OF_WORKERS) | |
rescue RSpec::Expectations::ExpectationNotMetError => error | |
error.message << "\n" | |
error.message << <<~HEREDOC | |
📎 Oh hi there! It looks like you changed the value of MySystem::NUMBER_OF_WORKERS. |
import simplejson | |
from boto.s3.connection import S3Connection | |
from boto.s3.key import Key | |
class S3KeyStore(object): | |
def __init__(self, access_key, secret_key, bucket): | |
self.conn = S3Connection(access_key, secret_key) | |
self.bucket = self.conn.create_bucket(bucket) | |
def get(self, key): |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
[ExecuteInEditMode] | |
public class CountdownTimer : MonoBehaviour { | |
public Text timerText; | |
public int startingSeconds; |
package { | |
import starling.core.Starling; | |
import starling.animation.Transitions; | |
import starling.animation.Tween; | |
public class Utils { | |
// This function accepts an originalX and originalY so that you can shake things that | |
// are on screen but not necessarily originally located at 0, 0 (compared to the original | |
// implementation which only ever moved things back to 0, 0) | |
public static function screenShake(drawable:Shakeable, shakeDuration:Number, intensity:Number, originalX:Number, originalY:Number):void { |
cat /usr/share/dict/words | grep '.\{3\}' | grep -v '.\{6\}' | sed 's/^/"/;s/$/",/' | pbcopy |
#!/usr/bin/env bash | |
# http://www.daveeddy.com/2014/06/29/human-readable-duration-in-bash/ | |
human() { | |
local seconds=$1 | |
if ((seconds < 0)); then | |
((seconds *= -1)) | |
fi | |
local times=( |
// util/log.as | |
package util { | |
import flash.system.Security; | |
import flash.external.ExternalInterface; | |
public function log(message:String):void { | |
flash.system.Security.allowDomain('*'); | |
flash.system.Security.allowInsecureDomain('*'); | |
ExternalInterface.call('console.log', message); | |
} | |
} |