Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

Adam Moore minikomi

🍕
I like pizza
View GitHub Profile
@minikomi
minikomi / Zippack.rb
Created February 8, 2012 11:24
Ruby zip unpacking
names = ['fred', 'bill']
ages = [33, 40]
locations = ['san francisco', 'dubai']
names.zip(ages, locations) do |n, a, l|
puts n
puts "lives in " + l
puts "is #{a} years old"
end
@minikomi
minikomi / gol.clj
Created February 14, 2012 09:04
game of life
(defn gol [ar](->>
(map
(fn [el] ; <= gets all neighbors
(let [x (first el) y (last el)]
(filter
(fn [s]
(and
(not-any? neg? s)
(not-any? #(< (dec (count ar)) %) s)))
(partition 2
@minikomi
minikomi / gist:1892015
Created February 23, 2012 09:55 — forked from lezhangxyz/gist:1890401
ctfsh
#!/bin/sh
if [ ! -t 0 ]; then
echo >&2 'STDIN is not a terminal'
exit 1
fi
clear
cd "$(mktemp -d)"
@minikomi
minikomi / getCol.js
Created February 28, 2012 03:00
Get rgb color from css color name
var name2rgb = function(str){
var canv=document.createElement("canvas");
canv.height = 1; canv.width = 1;
var ctx = canv.getContext("2d");
ctx.fillStyle="rgba(1,1,1,0.1)";
ctx.fillRect(0,0,1,1);
ctx.fillStyle=str;
ctx.fillRect(0,0,1,1);
var pxl= ctx.getImageData(0,0,1,1).data;
if(pxl[3] === 47){
@minikomi
minikomi / gist:1947762
Created March 1, 2012 06:24
To do - Github watched list bookmarklet
var user = $(".account-switcher-container .minibutton")
.text()
.replace(/^\s*/, "").replace(/\s*$/, "");
var url = "https://api.github.com/users/"+user+"/watched"+"?callback=?";
$.getJSON(url, function(docs){
$(".news").html("");
$.each(docs.data, function(i,r){
$(".news").append("repo: " + r.name + " ");
@minikomi
minikomi / egor.md
Created March 5, 2012 01:27
Egor's post

Taken from: http://homakov.blogspot.com/2012/03/how-to.html

current page views count: 43559. is it really interesting? If so, let's walk through what I did(since GH guys told me they fixed it)

  1. we have relations. Let me imagine what gh got inside of app:

    class PublicKey <.. belongs_to :user

@minikomi
minikomi / btree.js
Created March 5, 2012 08:06
B-Tree muck around
var btree = function(arr){
var tree = {
val : arr[0],
name: "Base"
l : {},
r : {}
};
var add_node = function (node, leaf, name){
if (node.val === undefined){
node.l = {};
@minikomi
minikomi / LICENSE.txt
Created March 13, 2012 09:19 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@minikomi
minikomi / fib.go
Created March 30, 2012 03:45
tour of go #46
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
r := 1
prev := 0
return func() int{
@minikomi
minikomi / tour.go
Created April 7, 2012 10:20
Tour of go
/* Exercise 1 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {