- Add Heroku to your Gemfile and
bundle install
. - Create your Heroku app. This will only work with their (currently-beta)
'cedar' stack, so you have to
heroku create --stack=cedar
. - Create a Procfile for your bot. This tells Heroku how to run your worker. In
our case, the bot is bot.rb, so the only line in the Procfile is
cinch: bundle exec ./bot.rb
- Commit and push to Heroku.
- You do not want a Web worker running, so
heroku scale web=0 cinch=1
. This also sets up your deployments to restart the bot.
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 'rubygems' | |
require 'sinatra' | |
get '/' do | |
@files = Dir['public/*'].map {|f| File.basename(f) } | |
erb :index | |
end | |
post '/upload' do | |
filename = params[:file][:filename] |
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
#! /usr/bin/python | |
# flixel (the script) is based on Adam Atomic's 'flx.py' script for | |
# creating various flixel-related objects in a fresh Flex Builder project. | |
# flixel (the script) changes the python path to be appropriate for Mac OS, | |
# generates any needed directories on its own behalf, | |
# relies on an environment variable (FLIXEL_HOME/lib) to locate flixel's org/... | |
# directory, and generates a Makefile for use with mxmlc. this behavior can be | |
# turned off by flipping flexBuilder back to true. it assumes mxmlc is in PATH. | |
# flixel (the script) also supports a three-argument version like so: |
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
By elasped time | |
+---------------------------+-----------+-----+------+-------+--------+-----------+-----------+ | |
| Name | Start Mem | 100 | 1000 | 10000 | 100000 | Final Mem | Time | | |
+---------------------------+-----------+-----+------+-------+--------+-----------+-----------+ | |
| ricardo_mendes_refactored | 10292 | 20 | 20 | 696 | 4420 | 14712 | 0.228459 | | |
| ali_rizvi | 10784 | 56 | 404 | 2568 | 31824 | 42608 | 0.323051 | | |
| ali_rizvi_fixed_inc | 9380 | 44 | 236 | 2096 | 32744 | 42124 | 0.370307 | | |
| ali_rizvi_fixed | 10048 | 56 | 428 | 2092 | 32100 | 42148 | 0.371651 | | |
| alberto_fernandez_capel | 10764 | 36 | 364 | 888 | 6288 | 17052 | 0.618822 | | |
| tj_singleton_refactored | 8232 | 20 | 300 | 828 | 16676 | 24908 | 0.733384 | |
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
/* | |
* bewbs.c: In goes the bewbs, out goes the C! | |
* By: Jean-Nicolas Jolivet,(c)2010 | |
* (.)(.) ++ptr | |
* (.){.} --ptr | |
* (.)[.] ++*ptr | |
* [.](.) -- *ptr | |
* [.][.] putchar(*ptr) | |
* {.}{.} *ptr=getchar() | |
* {.}[.] while(*ptr) { |
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
# Suppose you were designing a library named "Zippo". | |
# How would you organize the exceptions thrown by the library. | |
# Option 1 | |
# All library errors inheriting from a common base | |
module Zippo | |
class ZippoError < StandardError; end | |
class ZippoArgumentError < ZippoError; end | |
class ZippoTypeError < ZippoError; 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
I've added a control element with these properties/attributes: | |
method ; method to use for generated request e.g. POST/PUT/DELETE | |
content-type ; (optional) content-type of the request body generated by the template (defaults to application/hal+xml) | |
schema ; contains schema for data submitted to template | |
template ; (optional) A string or object representing the template or form for the request. | |
template-href ; (optional) Contains a URI which links to a resource where the template or form can be fetched. | |
template-type ; (optional) URI used to identify the template format in use (defaults to mustache). |
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 'rubygems' | |
require 'sinatra' | |
require 'omniauth/oauth' | |
set :sessions, true | |
set :layout, true | |
use OmniAuth::Builder do | |
provider :twitter, 'key', 'secret' | |
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
<html> | |
<head><title>{{title}}</title></head> | |
<body> | |
{{title}} spends {{calc}} | |
</body> | |
</html> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main(argc, argv) | |
int argc; | |
char** argv; | |
{ | |
char foo[3] = { 'b', 'y', 'e' }; | |
printf("%s\n", foo); | |
return 0; |
OlderNewer