Skip to content

Instantly share code, notes, and snippets.

View icholy's full-sized avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
body { padding: 50px; background-color: #f7f5fa; }
.led {
margin: 20px auto;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.25);
box-shadow: #000 0 -1px 6px 1px;
}
.led-red {
@icholy
icholy / duration_input.html
Created November 4, 2013 15:54
Duration.js + Angular.js Directive
<input type="text" ng-model="myDuration" duration>
@icholy
icholy / scan.go
Created November 5, 2013 20:56
(*sql.Rows).Scan() dynamically by column name.
// the target column name
name := "latitude"
// latitude value will be scanned into here
var latitude float64
// grab the column names
columns, _ := rows.Columns()
// columns will be scanned into this slice
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Vector_t { int* arr; int sz; int cap; };
typedef struct Vector_t Vector;
Vector*
vector_new(int sz, int cap)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Link_t {
int value;
struct Link_t* next;
};
typedef struct Link_t Link;
@icholy
icholy / download_jdk.md
Last active December 31, 2015 06:29
Downloading oracle jdk with wget.
import win32com.client
class Photoshop(object):
def __init__(self, psd_file):
self.psApp = win32com.client.Dispatch("Photoshop.Application")
self.psApp.Open(psd_file)
self.saved_state = self.psApp.ActiveDocument.ActiveHistoryState
self.layers = Photoshop.get_layers(self.psApp.ActiveDocument)
self.save_options = Photoshop.create_jpeg_save_options()
var log = console.log.bind(console, "HeatMap:");
var HeatMap = Backbone.View.extend({
initialize: function (args) {
log('initialize', args);
this.workspace = args.workspace;
this.id = _.uniqueId('heatmap_');
@icholy
icholy / daynight.py
Last active April 5, 2018 08:50
sunrise sunset calculation
#!/usr/bin/env python
# http://williams.best.vwh.net/sunrise_sunset_algorithm.htm
import math
from math import floor
# create wrapped trig functions which operate on degrees
def make_degree(f):
return lambda x: math.degrees(f(math.radians(x)))