Skip to content

Instantly share code, notes, and snippets.

@chrissharkey
chrissharkey / agedate.html
Created March 7, 2011 23:51
Calculate the age of person you can date based on your net worth
<html>
<head>
<title>Age Dating Calculator</title>
<script>
<!--
/* This function does the actual calculation as described in your email*/
function calculate(age, worth) {
/* If they are less than 14 assume they wouldn't date anyone more than 1 year
@chrissharkey
chrissharkey / pong.coffee
Created September 3, 2011 02:14
Bislr Pong Game
# $BISLR_APP_NAME Pong
# $BISLR_APP_AUTHOR Chris Sharkey
# $BISLR_APP_DESCRIPTION An exciting game involving two bats and a ball.
BAT_ACCELERATION = 0.40
BAT_TERMINAL_VELOCITY = 5
BAT_FRICTION = 0.10
BALL_ACCELERATION = 10
BALL_TERMINAL_VELOCITY = 10
BALL_FRICTION = 0
@chrissharkey
chrissharkey / bot.coffee
Created January 13, 2012 00:17
Coffee irc bot
#!/usr/bin/env node
CHANNEL = '#bozler'
MINIMUM_HUMAN_REACTION = 2
DIALOGUE =
ACTIONS_IN_REPLY: [
"We should rename Bislr to pineapple!",
"Of course! Why didn't I think of that? Call Bislr Pineapple!",
"Wow - smart idea - Bislr to rename to Pineapple",
@chrissharkey
chrissharkey / impartialoutsider.coffee
Created March 11, 2012 20:03
Pizza voting IRC bot in Node.js
#!/usr/bin/env node
CHANNEL = '#bozler'
MINIMUM_HUMAN_REACTION = 2
DIALOGUE =
ACTIONS_IN_REPLY: [
"I vote for pizza",
"Disregard that, I vote for pizza",
"Another vote for pizza!"
icj = ImageCreationJob.new :new_tag_name => "1.3.44-201309200518", :container => "1.3.44-201309200518", :asset_host => "http://8cb764c4db97361161d7-004cc728b3556a08f5656162392bdbf6.r34.cf2.rackcdn.com", :ssl_asset_host => "https://ecc8e1fed6c6fca9c206-004cc728b3556a08f5656162392bdbf6.ssl.cf2.rackcdn.com"
@chrissharkey
chrissharkey / apiary
Created April 21, 2015 05:08
How do I accept a parameter just for the GET and DELETE, but not the POST?
# Contact [/v1/contact]
## Get contact [GET]
## Add or update contact [POST]
## Delete a contact [DELETE]
for l in 0..lines.len() {
let (data, tx) = (data.clone(), tx.clone());
thread::spawn(move || {
let mut data = data.lock().unwrap();
*data += 1;
println!("LINE: {}", lines[l].clone());
tx.send(());
});
extern crate hyper;
use std::io::prelude::*;
use hyper::Client;
use hyper::header::Connection;
use hyper::header::Basic;
use hyper::header::Authorization;
use std::sync::{Arc, Mutex};
use std::thread;
use std::sync::mpsc;
let mut client = Client::new();
let mut req = client.post("http://localhost:3001");
let bytes = l.clone();
let request_body = Body::BufBody(bytes.as_bytes(), l.len());
req.body(request_body);
let mut res = req.header(Connection::close()).send().unwrap();
let mut view_keys = String::new();
res.read_to_string(&mut view_keys).unwrap();