This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Template { | |
public static $vars = array(); | |
public static function bind($key, $value) { | |
self::$vars[$key] = $value; | |
} | |
public static function render($name) { | |
$contents = file_get_contents($name.".php"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A simple text editor implemented in Java using JFrame | |
import java.awt.Font; | |
import java.awt.Toolkit; | |
import java.awt.Window; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.event.WindowEvent; | |
import java.io.BufferedWriter; | |
import java.io.File; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: shuffle dataset before gradient descent? | |
# import random libraries | |
from random import random, shuffle | |
# this function scales down from [0,1) to [0,0.16) in order to reduce the amount of "wobble" | |
def rand(): | |
return random()/6 | |
# main regressor class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import urllib | |
import json | |
music_type = raw_input("Track or Album? [t/a] ") | |
if music_type.startswith('t'): | |
music_type = 0 | |
elif music_type.startswith('a'): | |
music_type = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function disp() { | |
printf "\033[1;31m"; | |
printf "$1"; | |
printf "\033[0m\n"; | |
} | |
# Atom installation script | |
# By Ashwin Reddy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Cylindrical | |
 | |
Essentially extends polar to include a $z$-component. | |
$(r,\theta,z)$ | |
$$ | |
r = x\cos\theta \\\ | |
r = y\sin\theta \\\ | |
z = z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import numpy as np | |
class BanzhafPower(object): | |
def __init__(self, voting_system): | |
self.voting_system = voting_system | |
self.generate_coalitions() | |
self.compute_critical_count() | |
def generate_coalitions(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HuffmanTree(object): | |
def __init__(self, left, right): | |
self.left = left | |
self.right = right | |
def encode(self, symbol): | |
for branch, instruction in ((self.left, "0"), (self.right, "1")): | |
if type(branch) is HuffmanTree: | |
if branch.encode(symbol): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hs.loadSpoon("ReloadConfiguration") | |
spoon.ReloadConfiguration:start() | |
function resetImage() | |
screen = hs.screen.mainScreen() | |
screen:desktopImageURL("file:///Users/areddy/Pictures/original_8ee2e1707ce7198a75211221f99e6c2d.jpeg") | |
end | |
function updateImage() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; -*- mode: emacs-lisp -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
;; This is Ashwin Reddy's custom spacemacs config | |
(defun dotspacemacs/layers () | |
"Configuration Layers declaration. | |
You should not put any user code in this function besides modifying the variable | |
values." | |
(setq-default |
OlderNewer