Skip to content

Instantly share code, notes, and snippets.

require 'sinatra'
require 'rqrcode'
contact = "MECARD:N:Guy Fawkes;ADR:123 Gunpowder Rd, Walworth, England 123456;EMAIL:dumby@gmail.com;URL:http://google.com;;"
get '/' do
@qr = RQRCode::QRCode.new(contact, :size => 10, :level => :l)
erb :index
end
<style type="text/css">
body {
background-color: rgb(255, 45, 45);
}
table {
margin-top: 50px;
border-width: 0;
border-style: none;
/* engine.c */
int indexToBoard(int index) {
int row, col;
row = index / 3;
col = index % 3;
return board[row][col];
}
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("%s/.gtktactoe/config.json\n", getenv("HOME"));
}
static void spawnAboutDialog(GtkWidget *emitter, GtkWidget *aboutDialog);
GtkWidget *help;
GtkWidget *helpmenu;
GtkWidget *aboutButton;
GtkWidget *aboutDialog;
helpmenu = gtk_menu_new();
help = gtk_menu_item_new_with_mnemonic("_Help");
aboutDialog = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, accel_group);
date = new Date().toString().split ' '
console.log date[0] + ', ' + date[1] + ' ' + date[2] + ' ' + date[3] + ' ' + date[4] + ' '+ '-0600'
# => Tue, Jul 16 2013 11:48:42 -0600
@dheaney
dheaney / nbc.c
Created August 31, 2013 18:13
NBC sound with libao and C
/*
*
* nbc.c
*
* Modified by DJ Heaney - August 2013
* Original code (public domain) by Stan Seibert - July 2001
*
* Legal Terms:
*
* This source file is released into the public domain. It is
# Return a list of tuples containing string representations of, and references to, OBJECT's methods
import inspect
inspect.getmembers(OBJECT, predicate=inspect.ismethod)
from outbreak import Game
import inspect
game = Game(3 , 0)
player = game.players[0]
inspect.getargspec(player.drive)[0] # => ['self', 'city']
inspect.getargspec(inspect.getmembers(player, predicate=inspect.ismethod)[3][1])[0] # => ['self', 'city']
methods = [ x for x in inspect.getmembers(player,
@dheaney
dheaney / intsigfig.py
Created November 27, 2013 18:04
Return integer number of significant figures from an integer
from math import floor, log10
def sigfigs(x):
while((x % 10) == 0):
x = x / 10
return int(floor(log10(abs(x))) + 1)