Skip to content

Instantly share code, notes, and snippets.

View rafkhan's full-sized avatar
😳
im ok

Rafael Khan rafkhan

😳
im ok
View GitHub Profile
package main;
import (
"net"
)
func main() {
ln, err := net.Listen("tcp", ":8080")
if err != nil {
// handle error
acc = 1
for i in range(1, 5 + 1):
acc *= i
print(acc)
import sys
if len(sys.argv) < 3:
print("Must specify file name")
sys.exit(0)
in_fname = sys.argv[1]
out_fname = sys.argv[2]
with open(in_fname, "r") as in_file:
package main
import (
"fmt"
"reflect"
)
//function types
type mapf func(interface{}) interface{}
{types: [
{ name: "post",
backend_visible: false,
fields: [{
name: "name",
type: {name: "Int", max: 250, ...},
required: true
},
{
@rafkhan
rafkhan / slider_thinger_idunno.js
Created August 19, 2013 17:14
From urbaneer prototype slider. Note to self: This essentially has a function that executes periodically while the mouse is hovering over an element, and can change execution on move events. Wrap this.
function viewport() {
var e = window
, a = "inner";
if ( !( "innerWidth" in window ) ) {
a = "client";
e = document.documentElement || document.body;
}
return { width : e[ a+"Width" ] , height : e[ a+"Height" ] };
}
@rafkhan
rafkhan / explain.py
Last active December 20, 2015 21:59
FOR U
class Person:
def __init__(self, name):
self.name = name
def rap(self):
print("Whuddup bitch, this is MC " + self.name)
chode = Person("Jackson")
#
<?php
define('BASE_PATH', '/cafe');
define('DB_USER', 'root');
define('DB_PASS', 'password');
?>
@rafkhan
rafkhan / gist:5833615
Created June 21, 2013 19:18
god damnit PHP
RNode Object ( [action:RNode:private] => Closure Object ( ) [children:RNode:private] => Array ( [menu] => RNode Object ( [action:RNode:private] => Closure Object ( ) [children:RNode:private] => Array ( [item] => RNode Object ( [action:RNode:private] => [children:RNode:private] => [var_child:RNode:private] => RNode Object ( [action:RNode:private] => Closure Object ( [parameter] => Array ( [$args] => ) ) [children:RNode:private] => [var_child:RNode:private] => ) ) ) [var_child:RNode:private] => RNode Object ( [action:RNode:private] => Closure Object ( [parameter] => Array ( [$args] => ) ) [children:RNode:private] => [var_child:RNode:private] => ) ) [json] => RNode Object ( [action:RNode:private] => [children:RNode:private] => Array ( [menu] => RNode Object ( [action:RNode:private] => [children:RNode:private] => Array ( [item] => RNode Object ( [action:RNode:private] => [children:RNode:private] => [var_child:RNode:private] => RNode Object ( [action:RNode:private] => Closure Object ( [parameter] => Array ( [$args
@rafkhan
rafkhan / recursive_fib.py
Last active December 18, 2015 19:19
eat it, jackson
def fib(a,b):
print a;
if a < 100:
fib(b, a + b)
return
else:
return
return