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
class ProgressBar { | |
constructor (viewSize) { | |
this.viewSize = viewSize | |
this.circleStrokeColor = '#249fff' | |
this.circleStrokeWidth = 5 | |
this.circleFillColor = 'transparent' | |
let svg = this.svg = this.createSVG() | |
svg.setAttribute('width', viewSize) |
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
# http://EditorConfig.org | |
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
insert_final_newline = true | |
indent_style = space | |
indent_size = 2 |
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
// https://www.promisejs.org/generators/ | |
function async(makeGenerator) { | |
return function () { | |
var generator = makeGenerator.apply(this, arguments); | |
function handle(result){ | |
if (result.done) return Promise.resolve(result.value); | |
return Promise.resolve(result.value).then(function (res){ | |
return handle(generator.next(res)); |
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 isGenerator (input) { | |
return typeof input === 'function' && input.constructor.name === 'GeneratorFunction' | |
} |
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
// https://github.com/lodash/lodash/blob/51e459b386f8301c803442f7fc722e46fc192d35/lodash.js#L2573 | |
// 2 times faster! | |
function baseSlice(array, start, end) { | |
var index = -1, | |
length = array.length; | |
start = start == null ? 0 : (+start || 0); | |
if (start < 0) { | |
start = -start > length ? 0 : (length + start); | |
} |
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/env bash | |
if [ -x "/Applications/Tower.app" ] || [ -x "$HOME/Applications/Tower.app" ]; then | |
tower="Tower" | |
else | |
echo "Tower not found!" | |
exit 2 | |
fi | |
if [ -z "$1" ]; then |
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
// http://stackoverflow.com/questions/6715571/how-to-get-result-of-console-trace-as-string-in-javascript-with-chrome-or-fire | |
function getStackTrace () { | |
var obj = {} | |
// Remove arguments.callee from trace list | |
Error.captureStackTrace(obj, getStackTrace) | |
return obj.stack | |
} | |
console.log(getStackTrace()) |
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
angular.module('myApp', []) | |
.run(function ($rootScope, $exceptionHandler) { | |
$rootScope.$safeApply = function (exp) { | |
var phase = (this.$root || this).$$phase | |
if (phase !== '$apply' && phase !== '$digest') { | |
this.$apply(exp) | |
} else { | |
try { | |
this.$eval(exp) | |
} catch (ex) { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Monokai</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
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
var re = /^(\d{4})[-\/\.]{0,1}(?:(?:(11|0?[469])[-\/\.]?([12]\d|30|0?[1-9]))|(?:(1[02]|0?[13578])[-\/\.]{0,1}([1-2]\d|3[01]|0?[1-9]))|(?:(0?2)[-\/\.]{0,1}(2[1-9]|1\d|0?[1-9])))$/; | |
// test | |
[ | |
// valid dates | |
'2012-4-21', | |
'2012-04-21', | |
'2012-5-1', | |
'2012-05-31', | |
'2012-11-21', |
OlderNewer