Skip to content

Instantly share code, notes, and snippets.

View KirinDave's full-sized avatar

Dave Fayram KirinDave

View GitHub Profile
~ % curl -X POST http://chisai.local:9001/api -d '{"method":"available_methods","params":{"details":{"kind":"fake"}}}'
{"id":[],"error":null,"result":{"e1":["t"],"echo":["options","textsy"],"failboat":[],"killer":[],"kkthxbai":[],"mangler":[],"var":"variable"}}
<html>
<head>
<title>Our Example</title>
<!-- Get mootools in! -->
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools.js"></script>
<!-- This is where we do our thing -->
<script type="text/javascript" charset="utf-8">
// Run this awesome code *after* the page loads but *before* it displays.
window.addEvent('domready', function () {
class stack_of_ints =
object (self)
val mutable the_list = ( [] : int list ) (* instance variable *)
method push x = (* push method *)
the_list <- x :: the_list
method pop = (* pop method *)
let result = hd the_list in
the_list <- tl the_list;
result
method peek = (* peek method *)
(class object%
(init size) ; initialization argument
(define current-size size) ; field
(super-new) ; superclass initialization
(define/public (get-size)
current-size)
#lang web-server/insta
(define (start request)
`(html (head (title "Hello"))
(body (div ((class "content")) (h1 "Welcome")))))
#include <iostream>
#include <iomanip>
const int LOWER = 0;
const int UPPER = 300;
const int STEP = 20;
double f_to_c(double f){
return (f - 32) * (5.0 / 9.0);
}
id pickRandom(NSArray *arr) {
uint length = [arr count];
return [arr objectAtIndex:random() % length];
}
-(void) changeGreeting:(id)sender {
myLabel.font = [UIFont fontWithName:pickRandom([UIFont fontNamesForFamilyName:pickRandom([UIFont familyNames])]) size:36.0f];
myLabel.text = pickRandom(answers);//[answers objectAtIndex:random() % [answers count]];
}
//
// AnswerManager.h
// TabbedEightBall
//
// Created by Dave Fayram on 1/28/09.
// Copyright 2009 Powerset. All rights reserved.
//
#import <Foundation/Foundation.h>
- (void)drawRect:(CGRect)rect {
[[UIColor grayColor] setFill];
UIRectFill(rect);
[[UIColor blueColor] setFill];
CGRect drawnRect = CGRectInset(rect, 20.0f, 20.0f);
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, drawnRect);
CGRect elipseRect = CGRectInset(drawnRect, 25.0f, 25.0f);
CGPathAddEllipseInRect(path, NULL, elipseRect);
CGContextRef ctx = UIGraphicsGetCurrentContext();
task :clean do
important_cleans = `git clean -n -d`.split("\n")
important_cleans.reject! { |file|
file =~ /~$/ or
file =~ /#/ or
file =~ /.beam$/
}
if important_cleans.size > 0
puts "Refusing to clean because:"
puts important_cleans.join("\n")