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
queue = Queue.new | |
rest = *** | |
stream = *** | |
Thread.new do | |
loop do | |
delete_time, tweet = queue.pop | |
wait_time = delete_time - Time.now | |
sleep wait_time if wait_time > 0 | |
rest.destroy_status tweet |
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
<meta charset='utf-8'> | |
<script>var PUSHER_ENDPOINT='tompng-pusher.herokuapp.com:80'</script> | |
<script src='http://tompng-pusher.herokuapp.com:80/socket.io/socket.io.js'></script> | |
<script src='http://tompng-pusher.herokuapp.com:80/jspusher.js'></script> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'></script> | |
<script> | |
var server=new Server(); | |
function gameStart(room){ | |
Pusher.init(room); | |
Pusher.ondata=function(data){ |
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 './hoge' | |
Printer3D.generate 'out.stl' do | |
x------------------------------x | |
x-!--------------------------!-x | |
x--!!!--------------------!!!--x | |
x---!!!------------------!!!---x | |
x---!!!------------------!!!---x | |
x----!!!----------------!!!----x | |
x----!!!----------------!!!----x |
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
<script> | |
var allPoints=[]; | |
var lines=[]; | |
function dist(p1,p2){ | |
return (p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y); | |
} | |
function check(points, d){ | |
var out=[]; |
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
<meta charset=utf-8> | |
<script> | |
function SVG(width, height){ | |
this.width=width; | |
this.height=height; | |
this.content=''; | |
this.lineWidth=1; | |
this.trans={x:0,y:0,w:1,h:1}; | |
} | |
SVG.prototype={ |
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> | |
#define each_old(type, arr, code) {int _i;for(_i=0;_i<sizeof(arr)/sizeof(arr[0]);_i++){type=arr[_i];code}} | |
#define each(arr, type) {int _i;for(_i=0;_i<sizeof(arr)/sizeof(arr[0]);_i++){type=arr[_i]; | |
#define end }} | |
int main(){ | |
int array[]={1,2,5,4,3,2,1}; | |
char* sarr[]={"hello", "world", "foo"}; |
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
class VolatileHash | |
def initialize | |
@keys = [] | |
@hash = {} | |
end | |
def []= key, value | |
clean | |
if @hash.key? key | |
@hash[key][:id] = value.object_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
require 'net/http' | |
require 'json' | |
module Minecraft | |
class Client | |
def initialize host | |
@host = host | |
end | |
def get path | |
Net::HTTP.get URI.parse("http://#{@host}#{path}") | |
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
def get patterns | |
loop do | |
s = gets | |
p = patterns.find{|p|p=~s} | |
return [p, s] if p | |
end | |
end | |
number = /\d+/ | |
word = /[a-z]+/ |
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 'socket' | |
require 'shiritori' | |
queue = Queue.new | |
shiritori = Shiritori::Main.new | |
sockets = [] | |
shiritori.define_singleton_method :get_command do | |
queue.deq | |
end |
OlderNewer