This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sadf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User | |
= Activated | |
| Deleted | |
update state = | |
case state of | |
Activated -> | |
-- do something | |
Deleted -> | |
-- do again |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Typescript language spec, https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md, is the definitive guide for | |
// how to annotate a react class, or anything else. But, sometimes, examples with a lot of SEO compatible words is better. | |
// Annotate a decorator that takes a react class, and wraps it. It'll have the same props as it's child. | |
export const decorateWithX = <T extends {}>(Comp: ComponentClass<T>): ComponentClass<T> => class extends PureComponent<T, State> { | |
} | |
// https://github.com/Microsoft/TypeScript/issues/4922 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a require function that works just like in node, but can require any npm package, with it's version too. | |
// example 1 : require('lodash'); instanceof window.lodash === 'object' | |
function require(npmModule) { | |
console.info(`Attempting to load ${npmModule}...`); | |
var version = npmModule.indexOf('@') !== -1 ? '' : '@latest'; | |
var body = document.getElementsByTagName('body')[0]; | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; | |
script.src = `https://wzrd.in/standalone/${npmModule}${version}`; | |
script.onload = () => console.log(`Loaded ${npmModule}!`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module '*.icss' { | |
const styles: { | |
[className: string]: string | |
}; | |
export default styles; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run with administrator rights, | |
# you can simply copy and paste into a powershell session | |
$PATH = [Environment]::GetEnvironmentVariable("PATH"); | |
$subl = "C:\Program Files\Sublime Text 3"; | |
[Environment]::SetEnvironmentVariable("PATH", "$PATH;$subl", "Machine"); | |
refreshenv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.remove = function(str) { return this.replace(str, ''); }; | |
String.prototype.surround = function(char, char2=char) { return char + this + char2; }; | |
// String.prototype.print = function() { console.log(this); return this; }; | |
foo = location.search | |
.remove('?') | |
.split('&') | |
.map(exp => exp.split('=').map(str => str.surround('"')).join(':').surround('{', '}')) | |
// .print() | |
.join(',') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(url) { | |
var scriptTag = document.createElement('script'); | |
scriptTag.type = 'text/javascript'; | |
scriptTag.async = true; | |
scriptTag.src = url; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(scriptTag, s); | |
})(URL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# xxx turn this into a bower/npm module | |
Object.defineProperty Array.prototype, "last", { get: -> this[this.length - 1]} | |
Object.defineProperty Array.prototype, "first", { get: -> this[0]} | |
Function::property = (prop, desc) -> | |
Object.defineProperty @prototype, prop, desc | |
Function::getter = (prop, get) -> | |
Object.defineProperty @prototype, prop, {get, configurable: yes} | |
Function::setter = (prop, set) -> | |
Object.defineProperty @prototype, prop, {set, configurable: yes} |