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
# prompt | |
__aws_ps1() { | |
local printf_format="$1" | |
local profile="${AWS_PROFILE:-ekreative}" | |
if [ "$profile" != "ekreative" ]; then | |
printf -- "$printf_format" "${AWS_PROFILE:-ekreative}" | |
fi | |
} | |
__gcloud_ps1() { |
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 is an copy of NSCache but in a more Swift friendly way | |
// Can store Any, with any Hashable key, so you are not limited | |
// to NSObjects as with NSCache | |
// | |
// Copyright (c) 2017 Fred Cox | |
// Licensed under Apache License v2.0 with Runtime Library Exception | |
// | |
// Based on the NSCache code from the swift project | |
// https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSCache.swift |
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
'use strict'; | |
const FormData = require('form-data'), | |
fetch = require('node-fetch'); | |
Promise.all([ | |
fetch('http://httpbin.org/stream/10'), | |
fetch('http://httpbin.org/stream/10') | |
]).then(res => { | |
let data = new FormData(); |
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
'use strict'; | |
const FormData = require('form-data'), | |
fetch = require('node-fetch'); | |
Promise.all([ | |
fetch('http://httpbin.org/stream/10'), | |
fetch('http://httpbin.org/stream/10') | |
]).then(res => { | |
let data = new FormData(); |
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 a = true; | |
function doStep() { | |
.... | |
if (a) { | |
setTimeout(doStep, 10); | |
} | |
} | |
setTimeout(doStep, 10); |
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
[].forEach.call(document.querySelectorAll('td[data-href]'), function(el) { | |
el.addEventListener('click', function (event) { | |
window.document.location = this.getAttribute('data-href'); | |
}); | |
}); | |
$('td[data-href]').on('click', function() { | |
window.document.location = $(this).attr('data-href'); | |
}); |
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
int isEven(int i) { | |
if (i == 0) { | |
return 1; | |
} | |
else if (i == 1) { | |
return 0; | |
} | |
else if (i < 0) { | |
return isEven(i + 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
;;; --- Skip lots of stuf --- | |
;;; <@19,#13> compare-numeric-and-branch | |
0x49252d6f 47 83f800 cmp eax,0x0 | |
0x49252d72 50 0f843e000000 jz 118 (0x49252db6) | |
;;; <@20,#17> -------------------- B2 (unreachable/replaced) -------------------- | |
;;; <@24,#24> -------------------- B3 -------------------- | |
;;; <@27,#26> compare-numeric-and-branch | |
0x49252d78 56 83f802 cmp eax,0x2 ;; debug: position 81 | |
0x49252d7b 59 0f842a000000 jz 107 (0x49252dab) |
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
app.use(function(req, res, next) { | |
var oneof = false; | |
if(req.headers.origin) { | |
res.header('Access-Control-Allow-Origin', req.headers.origin); | |
oneof = true; | |
} | |
if(req.headers['access-control-request-method']) { | |
res.header('Access-Control-Allow-Methods', req.headers['access-control-request-method']); | |
oneof = true; | |
} |
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
/* | |
* return an object with two functions | |
* push - push an invocation of t.f(args) which will be called immediately if the q is empty | |
* next - the function that should be called in f to signal that the next invocation can be run | |
* important! - every function given to push should call next | |
*/ | |
function lock() { | |
var q = [], busy = false; | |
return { | |
push: function(f, args, t) { |
NewerOlder