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
var readline = require('readline');
type Expression = any;
class Thunk {
private forced = false;
private value: any;
constructor(
private fn: Function,
@icholy
icholy / ideas.md
Last active November 2, 2015 18:43

My Awesome Language

An imperative looking syntax for lisp.

Expressions (Find a way to avoid return)

 { return 1 }
import random
import math
def rand7():
return random.randrange(1,8)
def rand5_mod():
return rand7() % 5 + 1
def rand5_recursive():
  • The gain is how much of the new measurement to use.
  • The measurement error is constant and depends on the source.
interface Estimate {
  value: number;
  error: number;
}
declare module flatbuffers {
/**
* @typedef {number}
*/
export type Offset = number;
/**
* @typedef {{
* bb: flatbuffers.ByteBuffer,
#include "http_core.h"
#include "http_request.h"
static int auth_dummy_handler(request_rec *r)
{
return HTTP_UNAUTHORIZED;
}
static void register_hooks(apr_pool_t *pool)
{
package main
import (
"bytes"
"strconv"
)
type Buffer struct {
bytes.Buffer
}
class ListenerGroup {
/**
* Unbinding functions are placed in this array Unbind functions are placed in this array.
*/
private _unbind = [];
/**
* A helper class for managing groups of listeners
* on a specific scope.

I've been trying to find an elegant way of dealing with events in TypeScript/AngularJS recently. If you're not farmiliar with Angular, that's ok, this is a pretty common pattern.

Here I have a controller that registers an event listener:

function MyController($rootScope) {
  $rootScope.$on('event1', () => {
    console.log('event 1 occured');
  });
/**
* angular-bootstrap-switch
* @version v0.4.1 - 2015-06-15
* @author Francesco Pontillo (francescopontillo@gmail.com)
* @link https://github.com/frapontillo/angular-bootstrap-switch
* @license Apache License 2.0(http://www.apache.org/licenses/LICENSE-2.0.html)
**/
!function(){"use strict";angular.module("frapontillo.bootstrap-switch",[]),angular.module("frapontillo.bootstrap-switch").directive("bsSwitch",["$parse","$timeout",function(a,b){return{restrict:"A",require:"ngModel",link:function(c,d,e,f){var g=!1,h=function(){if("radio"===e.type)return e.value||a(e.ngValue)(c)||!0;var b=a(e.ngTrueValue)(c);return angular.isUndefined(b)&&(b=!0),b},i=function(a){return c.$eval(a)===!0},j=function(a){return a===!0||"true"===a||!a},k=function(a){return a?a:void 0},l=function(a){var b={switchRadioOff:j,switchActive:function(a){return!j(a)},switchAnimate:j,switchLabel:function(a){return a?a:"&nbsp;"},switchIcon:function(a){return a?"<span class='"+a+"'></span>":void 0},switchWrapper:function(a){return a||"wrappe