Skip to content

Instantly share code, notes, and snippets.

@colinkahn
colinkahn / jstatd.sh
Last active February 9, 2022 22:50 — forked from nicerobot/jstatd.sh
Run jstatd w/o error 'access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)'
#!/bin/sh
policy=.jstatd.all.policy
[ -r ${policy} ] || cat >${policy} <<'POLICY'
grant codebase "file:${java.home}/" {
permission java.security.AllPermission;
};
POLICY
jstatd -J-Djava.security.policy=${policy} &
// data.ts
interface IBalance {
addBalanceEntry(amount: number): void
currentBalance(): number
}
// transfer_money.ts
interface Destination {
@colinkahn
colinkahn / about
Created September 16, 2017 01:09
React Redux Module
# Goals:
- Modular project structure organized by features
- Module boundaries
- Avoid circular dependencies
- Standard Redux approach
# Problem
When defining actions, reducers, selectors and components in a module.
Module reducer or reducers are combined and used in project application root reducer at specific state slice path.
Components receives root state with connect (react-redux) which is passed to selectors.
@colinkahn
colinkahn / README.md
Last active June 12, 2017 15:05
Clojure Learning Resources / Exercises
(defprotocol Operator
(operator [x] "returns the operator function for x"))
(defmulti keyword->operator identity)
(extend-type Keyword
Operator
(operator [kw] (keyword->operator kw)))
(extend-type string
@colinkahn
colinkahn / service-destroyer.ts
Created March 1, 2017 18:39
Angular ServiceDestroyer
import { Inject, Injectable, OnDestroy } from "@angular/core";
/**
* Solves the following with `ngOnDestroy`:
* - https://github.com/angular/angular/issues/14821
* - https://github.com/angular/angular/issues/14818
*/
export function provideServiceDestroyer(Service: any) {
@Injectable()
class ServiceDestroyer implements OnDestroy {
@colinkahn
colinkahn / SassMeister-input-HTML.html
Created November 18, 2015 01:47
Generated by SassMeister.com.
<div style="border: 1px dotted black">
foo
<div class="c-inline-list">
<div class="c-inline-list__row">1</div>
<div class="c-inline-list__row">2</div>
<div class="c-inline-list__row">3</div>
</div>
bar
<div class="c-inline-list--drop">
<div class="c-inline-list__row">1</div>
@colinkahn
colinkahn / SassMeister-input-HTML.html
Last active November 18, 2015 01:08
Generated by SassMeister.com.
<div class="o-pack">
<div class="o-pack__item">
<label class="c-label u-margin-right-small">Name
<input class="c-input c-input--full"/>
</label>
</div>
<div class="o-pack__item">
<label class="c-label u-margin-right-small">Password
<input class="c-input c-input--full"/>
</label>

Modules

var app = angular.module('app', []);

Using modules in views

 
/*
Leaflet 0.8-dev (3ded683), a JS library for interactive maps. http://leafletjs.com
(c) 2010-2014 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/
(function (window, document, undefined) {
var L = {
version: '0.8-dev'
};
function expose() {