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 <arpa/inet.h> | |
#include <errno.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <strings.h> | |
#include <dns_sd.h> | |
void callback(DNSServiceRef sdRef, |
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/env ruby | |
# | |
# hey! a minimalist CRM for http://todotxt.com/ | |
# | |
# hey tells you one thing you should do regularly, but haven't done lately. | |
# | |
# $ todo.sh lf hey | |
# 1 @phone Mom (+1 234 567 8901) +family | |
# 2 @skype Dad +family | |
# 3 @email mentor |
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 'minitest/autorun' | |
class Account < Struct.new :balance | |
end | |
class MoneyTransfer < Struct.new :source, :destination | |
def initialize source, destination | |
super | |
source.extend Transferrer | |
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
require 'benchmark' | |
require 'delegate' | |
class Direct | |
def method | |
'direct' | |
end | |
def base | |
'base' |
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
// PhantomJS doesn't support bind yet | |
Function.prototype.bind = Function.prototype.bind || function (thisp) { | |
var fn = this; | |
return function () { | |
return fn.apply(thisp, arguments); | |
}; | |
}; | |
(function(p) { | |
var fs = require('fs'), |
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 'digest/sha1' | |
class Proof < Struct.new :data, :difficulty, :token | |
def valid? | |
hash = Digest::SHA1.hexdigest("#{data} #{difficulty} #{token}") | |
pl = prefix_length(hash.to_i(16)) | |
difficulty <= pl | |
end | |
def increment |
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
program YearTenComputerSystemsProjectByBrandonEthakadaAndTaiBellLiu; | |
uses ptccrt, ptcgraph; | |
var keyz : string; | |
selection,speed : integer; | |
procedure InitIt; | |
var gd, gm : integer; | |
begin | |
Gd := d8bit; | |
Gm := m640x480; |
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
# -*- coding: utf-8 -*- | |
# Welcome to the Chinese Support Add-on's field edition ruleset. | |
# Here, you can tweak the note editor helper's behavior to your liking. | |
# | |
# If you messed things up, you can safely delete file | |
# addons/chinese/edit_behavior.py from your Anki directory. | |
# It will be recreated the next time you restart Anki. | |
# | |
# You can read about all available functions at: | |
# https://github.com/ttempe/chinese-support-addon/wiki/Edit-behavior |
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 'date' | |
require 'minitest/autorun' | |
class Time | |
def self.normalize time | |
dt = DateTime.parse(time).to_time.utc | |
Time.utc(Time.now.year, nil, nil, dt.hour, dt.min) | |
end | |
def inbetween start_time, end_time |
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 Thing < Struct.new(:color) | |
@@things = {} | |
def self.parse description | |
type_name, color = description.split | |
@@things[type_name].new color | |
end | |
def self.type_code code | |
@@things[code] = self |