Skip to content

Instantly share code, notes, and snippets.

View alextkachman's full-sized avatar

Alex Tkachman alextkachman

View GitHub Profile
@alextkachman
alextkachman / gist:bda667b09c0c4b7f9ee8
Last active August 29, 2015 14:08
Patch for injector to resolve promises
(function(angular){
"use strict";
/**
* Patched $injector.invoke
*
* It allows in many situations to avoid promise related boilerplate like
*
* factory('$loggedUser',['$login','$loadedConfig',function($login,$loadedConfig){
* return $login.then(function($login){
@alextkachman
alextkachman / gist:8d0ad2bc21307b689819
Last active August 29, 2015 14:06
Any object can be event target
angular.module('EventTarget',[])
.run(['$injector',function($injector){
function removeFromList(list,item) {
var next = item.next || null
var prev = item.prev || null
if (prev) {
prev.next = next
}
else {
@alextkachman
alextkachman / gist:9802138
Last active August 29, 2015 13:57
Failing kotlin2js codegen for delegated extension properties
// Kotlin example
class Delegate() {
fun get(obj: String, desc: PropertyMetadataImpl) : String = obj.toString() + ".log"
}
val String.log by Delegate()
fun main(args : Array<String>) {
println("Hello, world!".log)