This file contains hidden or 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/env ruby | |
require 'sinatra' | |
require 'open-uri' | |
get '/' do | |
result = open("http://webapp/hello").read | |
"#{result}\nDisclaimer: above statement may not actually be true.\n" | |
end |
This file contains hidden or 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
class Address | |
def initialize address, display_name, domain | |
@address = address | |
@display_name = display_name | |
@domain = domain | |
end | |
attr_reader :address, :display_name, :domain | |
def self.from_header h # returns an Array of Addresses |
This file contains hidden or 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
(ns potato.core | |
(:use [slingshot.slingshot :only [throw+ try+]]) | |
(:use [clojure.string :only [trim split]])) | |
;; use this provide template values at write time (i.e. not compile time). | |
;; "name" will be the name of the template variable. "context", when not nil, | |
;; will be the value previously returned by *template-value* for the enclosing | |
;; section. | |
(defn ^:dynamic *template-value* [name context]) |
This file contains hidden or 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
## THIS VERSION HAS SOME BUGS | |
## SEE http://masanjin.net/blog/using-redis-for-scheduling for the fixes | |
## | |
## call schedule! to schedule an item at a specific time. | |
## call blocking_each to have each item yielded to you, on or after its scheduled time. | |
## items will be placed in ERROR_QUEUE during the course of processing. clean these up at will. | |
class Scheduler | |
QUEUE = "q" | |
ERROR_QUEUE = "eq" |
This file contains hidden or 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/env ruby | |
require 'sinatra' | |
$conts = [] | |
def link_to title, &b | |
id = $conts.size | |
$conts[id] = b |
This file contains hidden or 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> | |
#include <sys/time.h> | |
#include <time.h> | |
#include <string.h> | |
#define SIZE (1024 * 1024 * 500) | |
#define TIMES 10000000 | |
#define START_TIMER() { \ |