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

I prefer this

var distance = metersToNauticalMiles(
  utils.getDistance(
    utils.toPoint(coordinates.get(0)),
    utils.toPoint(coordinates.get(1))
  )
);

Here's a very simple controller and service. The service can be turned on and off with a checkbox.

<body ng-app="App">
  <div ng-controller="MyController">
    <input type="checkbox" ng-model="enabled">
  </div>
</body>
// Use Case:
//
// Say you have a bunch of decoupled components which access the same set of databases.
// Since database/sql does connection pooling it makes sense for the components to share instances of *sql.DB
// This package lets you do that with minimal code changes.
package dbmanager
import (
"database/sql"
"time"

Keybase proof

I hereby claim:

  • I am icholy on github.
  • I am icholy (https://keybase.io/icholy) on keybase.
  • I have a public key whose fingerprint is C620 B860 AF4D 339A 9D40 F764 ADF7 55F3 74A0 0CCB

To claim this, I am signing this object:

There is a 1-to-1 relationship between ids and items.

with item_ids as (
	      select 1 as id
	union select 2
	union select 3
	union select 4
	union select 5
	union select 6
@icholy
icholy / go_js.md
Last active August 29, 2015 14:09
Go style javascript

Js style (one of many):

// constructor
var Foo = function () {};

// private
Foo.prototype._poo = function () {};

// public
/**
* 1. Go to this page: https://my.playstation.com/logged-in/trophies/public-trophies/ (using google chrome)
* 2. Right click on the page and select "inspect element"
* 3. Go to the "console" tab.
* 4. Change the names below with the ones you want to test
* 5. Copy/Paste the following script in the console and hit "enter".
*/
(function () {
// in C++
class Foo {
int a;
int b;
void set_a(int a) {
this->a = a;
}
@icholy
icholy / vector.c
Last active August 29, 2015 14:10
typedef struct {
int *data; // array
int cap; // capacity
int len; // length
} Vector;
Vector * vector_create(int length, int capacity) {
Vector *v = malloc(sizeof(Vector));
if (v == NULL) {
#!/usr/bin/env
from datetime import datetime
import matplotlib.pyplot as plt
def main():
lines = open("commits.txt").read().split("\n")
lines = [l.split(",") for l in lines]
lines = [l for l in lines if l[0].strip() != '']