Skip to content

Instantly share code, notes, and snippets.

View thenormalsquid's full-sized avatar
I'm your huckleberry

Thien-Bach Huynh thenormalsquid

I'm your huckleberry
View GitHub Profile
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1
owGbwMvMwMSouj46n71nXTrj6QPfkhhCtpi+qVZKyk+pVLKqVkrOyUzNKwGx8hJz
U5WslLJTK5MSi1P1MvMV8vJTUvWyihWganSUylKLijPz84CqDPTM9YyVanVAykGa
0zLz0lOLCooyQWYpWRqkWSYnJxuZmhslm5klmgDp1KQkE0OTROM0ozQLs7RkoxQz
M+MkoJEZ+cUlKLYqgc2Mz0wBipo4GrsZuVmYuTkbuQDVOwHlSsESpqlpycmGqSZm
SckWhklJqaaGxklJiWbmBhYWpgZmBgYghcWpRVAvFSWmZCYn5iQnZqcWg9wMlCnL
TE5F8nR6ZklGaRKqrpKM1Lz8otzEnOJCkKVAfSWVBSCJ8tSkeKgR8UmZeSlAryOH
jSFQZXJJJsgMQxMjQwNLMxMjCx2l1IqCzKLU+EyQClNzMwsDINBRKihKLVOyyivN
@thenormalsquid
thenormalsquid / one.sh
Created January 23, 2015 05:54
one liner reddit thingy
curl --header "X-Ratelimit-Used: 1 User-Agent: radicalcakes" http://www.reddit.com/r/all.json?limit=10 | jsawk 'return this.data.children' | jsawk 'return this.data' | jsawk 'return this.url'
Ext.define('SkyNet.store.ActiveResidentsStore', {
extend: 'Ext.data.Store',
config: {
model: 'SkyNet.model.Resident',
sorters: 'LastName',
storeId: 'ActiveResidentsStore',
autoload: true,
grouper: {
groupFn: function (record) {
return record.get('LastName')[0];
PID:
7589
run.sh: 4: run.sh: [[: not found
Connector not running. starting.
Traceback (most recent call last):
File "./bot.py", line 3, in <module>
from api import handlers
File "/home/squid/scaling-octo-robot/api/__init__.py", line 2, in <module>
from api.irc_actions import *
File "/home/squid/scaling-octo-robot/api/irc_actions.py", line 9
function playTheGame(event) {
var rows = world.stage.canvas.width,
cols = world.stage.canvas.height;
for(int r = 0; r < rows; r += cellHeight) {
for(int c = 0; c < cols; c += cellWidth) {
//form neighborhood here,
//count num cells
//return center cell, if it doesn't exist, add one
var asyncFunction = (param, callback) => {
window.setTimeout(() => {
callback(param);
}, 1);
};
var o = {
doSomething: function () {
// Here we pass `o` into the async function,
// expecting it back as `param`.
@thenormalsquid
thenormalsquid / newton.go
Created August 20, 2015 23:43
Newton approx
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
delta, z := float64(1), float64(1)
for delta > 1e-9 {
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
<h1>Comments</h1>
<CommentList data={this.props.data} />
<CommentForm />
</div>
);
}
@thenormalsquid
thenormalsquid / invert_bin_tree.py
Created August 27, 2015 20:53
invert_bin_tree
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def swap_nodes(self, node):
tmp = node.right
@thenormalsquid
thenormalsquid / pre-commit.sh
Created February 14, 2016 22:59
grunt jshint pre-commit hook
#!/bin/sh
# This pre-commit hook prevents lint errors from getting committed
# Requires jshint and grunt
jshintout=$(/usr/local/bin/grunt jshint)
exitcode=$?
files=$(git diff --cached --name-only --diff-filter=ACM | grep "\.js$")
if [ "$files" = "" ]; then
exit 0
fi