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
/** | |
* Creates line element on given position, with given length and angle. | |
*/ | |
function createLineElement(x, y, length, angle) { | |
var line = document.createElement("div"); | |
var styles = 'border: 1px solid black; ' | |
+ 'width: ' + length + 'px; ' | |
+ 'height: 0px; ' | |
+ '-moz-transform: rotate(' + angle + 'rad); ' | |
+ '-webkit-transform: rotate(' + angle + 'rad); ' |
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
/** | |
* This function extends console.log functionality with given logger. | |
* @param {function} logger - Custom logger | |
*/ | |
function extendLog(logger) { | |
var original = console.log; | |
console.log = function() { | |
logger(Array.prototype.slice.call(arguments)); | |
return original.apply(this, arguments); | |
} |
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
/** | |
* This script uses ECMAScript 2015 syntax. | |
* Check compatibility for your environment. | |
* To run it in nodejs (5.8.0) you need to enable feature flags: | |
* --harmony_destructuring --harmony_rest_parameters --harmony_default_parameters | |
*/ | |
"use strict" | |
/** |
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
/** | |
* Returns promise which runs given callback functions in series and | |
* collect results in array. | |
* | |
* @param {array} promises - array of callback functions | |
*/ | |
function promiseAllSeq(promises) { | |
var data = []; | |
return promises.reduce((p, fn) => p.then(fn).then(i => (data.push(i), data)), Promise.resolve()); |
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
const M = require('module') | |
const _load = M._load; | |
M._load = function(request, ...rest) { | |
const _module = _load(request, ...rest) | |
if (request === './module1.js') { | |
return function(...args) { | |
console.log(`intercepting ${request}`) | |
_module(...args) | |
} |
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
#!/usr/bin/python | |
import sys | |
import urllib | |
source_enc = 'windows-1250' | |
target_enc = 'utf-8' | |
print '=============================================' | |
print '=== conversion from windows-1250 to utf-8 ===' | |
print '=============================================' |
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 React, { Component } from 'react' | |
import { theme, Text, View, withStyles } from 'react-native-themeable' | |
const redTheme = withStyles([ | |
{ | |
$type: Text, | |
color: 'white', | |
fontSize: 26, | |
}, { | |
$type: View, |
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 ESLintFix() | |
write | |
silent execute "!./node_modules/.bin/eslint --fix %" | |
edit! % | |
redraw! | |
endfunction | |
command W call ESLintFix() |
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
git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all" |
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
const a = {b: 1, c: 2} | |
cost Component = () => ( | |
<div prop={1} | |
other={2} /> | |
) | |
import { hahahahahahaha, heheheheheheh, huhuhuhuhuhu, hihihihihihi, hohohohoho } from 'react-hahahaha-heheheh-huhuhu' | |
function foo( |
OlderNewer