Skip to content

Instantly share code, notes, and snippets.

@carsonmcdonald
carsonmcdonald / gist:735780
Created December 10, 2010 04:24
Lucky 13 - Java
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Scanner;
public class Lucky
{
public static int winnings(int bet) throws Exception
{
return "13".equals(new Scanner(((InputStream) new URL("http://roulette.engineyard.com/").getContent())).findInLine("\\d+")) ? bet * 35 : 0;
@carsonmcdonald
carsonmcdonald / gist:911761
Created April 9, 2011 20:48
node.js SPDY proxy
var tls = require('tls');
var fs = require('fs');
var Buffer = require('buffer').Buffer;
var zlib = require('zlib');
var BufferList = require('bufferlist');
var Binary = require('bufferlist/binary');
var Put = require('put');
var http = require('http');
var options =
@carsonmcdonald
carsonmcdonald / revspdynpn.sh
Created April 27, 2011 14:52
How to set up ruby, eventmachine and spdy to use NPN
#
# Get development tools installed
#
sudo yum install -y git cvs zlib-devel
sudo yum groupinstall -y "Development Tools"
#
# Install RVM
#
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
@carsonmcdonald
carsonmcdonald / ALL_BUILD.out
Created May 31, 2012 03:17
Results of xcodebuild -project mruby.xcodeproj -target ALL_BUILD clean build and xcodebuild -project mruby.xcodeproj -target mruby clean build
=== CLEAN AGGREGATE TARGET ZERO_CHECK OF PROJECT mruby WITH THE DEFAULT CONFIGURATION (Debug) ===
Check dependencies
Clean.Remove clean build/mruby.build/Debug/ZERO_CHECK.build
builtin-rm -rf /tmp/mruby/build/mruby.build/Debug/ZERO_CHECK.build
=== CLEAN NATIVE TARGET xpcat OF PROJECT mruby WITH THE DEFAULT CONFIGURATION (Debug) ===
Check dependencies
set -g default-terminal "screen-256color"
set -g history-limit 20000
# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix
# Bind appropriate commands similar to screen.
# lockscreen ^X x
#import "EmailShareType.h"
@implementation EmailShareType
{
UIViewController *pvController;
}
- (void)share:(UIViewController *)parentViewController
{
pvController = parentViewController;
@carsonmcdonald
carsonmcdonald / gist:4428542
Created January 1, 2013 16:49
CouchDB map function used to count #code2012 entires.
{
map: function (doc)
{
if(doc.text.indexOf("RT ") != -1 || doc.text.indexOf("RT:") != -1 ||
doc.text.indexOf("rt ") != -1 || doc.text.indexOf("rt:") != -1)
{
return;
}
function pre_replacements(obj)
MRuby::Build.new do |conf|
conf.cc = ENV['CC'] || 'gcc'
conf.ld = ENV['LD'] || 'gcc'
conf.ar = ENV['AR'] || 'ar'
conf.cflags << (ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration))
conf.ldflags << (ENV['LDFLAGS'] || %w(-lm))
end
SIM_SYSROOT="#{SIMSDKPATH}"
@carsonmcdonald
carsonmcdonald / buildmrubyforosx.sh
Last active December 14, 2015 03:28
Grabs the current version of mruby and builds it as a framework that will work for embedding in OS X apps.
#
# Grab the latest mruby
#
git clone git://github.com/mruby/mruby.git
cd mruby
make clean
make
make test
cd ..
@carsonmcdonald
carsonmcdonald / missingbowerrepos.txt
Created April 22, 2013 16:24
A list of missing bower repos
zoe
yourpackagename
urturn-expression-css
underscoreDeepExtend
ui-calendar
typeahead
twangular
toolkit
time
testingStash