Skip to content

Instantly share code, notes, and snippets.

View oliverlundquist's full-sized avatar

Oliver Lundquist oliverlundquist

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-align: center;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
@oliverlundquist
oliverlundquist / type-safety.ts
Last active July 19, 2016 11:37
Type Safety
type Mixtype = String|Number;
class SomeClass<T extends Mixtype> {
somemethod(arg: T): T {
return arg;
}
}
var somevar = new SomeClass<Number>();
console.log(somevar.somemethod(123));
$('.searchform').submit(function (event) {
var mode = $(this).find("input[name='mode']:checked").val();
var keyword = $(this).find("input[name='keyword']").val();
var endpoint = mode === 'srh' ? '/?mode=srh&keyword=' + keyword : '/note/?s=' + keyword;
// set new endpoint
// $(this).attr('action', endpoint);
// prevent default event action
event.preventDefault();
var params = {};
var keyUpStream = null;
var requestStream = null;
keyUpStream = Rx.Observable
.fromEvent(this.$el, 'keyup')
.map(function (event) { return event.target.value; })
.distinctUntilChanged();
requestStream = keyUpStream
var a = Rx.Observable.fromEvent(document, 'click')
.flatMapLatest(function () {
return Rx.Observable.defer(function () {
return new Promise(function (resolve) {
setTimeout(function () { resolve('hey'); }, 2000);
});
});
});
var b = a.subscribe(function () { console.log(arguments[0]); });
<!DOCTYPE html>
<html>
<head>
<title>RxJS Playground</title>
<style>
body {
padding-top: 50px;
}
.cube {
ssh -i ~/.vagrant.d/insecure_private_key 192.168.100.109 '
HOST='0.0.0.0'
USERNAME=root
PASSWORD=root
DATABASE=mystore2
TABLES='mysql --host=$HOST --user=$USERNAME --password=$PASSWORD --database=$DATABASE --batch --silent --execute \'SHOW TABLES LIKE \'chips_%\'\''
mysqldump --host=$HOST --user=$USERNAME --password=$PASSWORD --no-data $DATABASE $TABLES
' > test.sql
ssh -i ~/.vagrant.d/insecure_private_key 192.168.100.109 <<- ENDSSH > test.txt
mysqldump -h0.0.0.0 -uroot -proot -d mystore2 mysql -h0.0.0.0 -uroot -proot -D mystore2 -Bse "SHOW TABLES LIKE 'chips_%'"
ENDSSH
ssh -i ~/.vagrant.d/insecure_private_key 192.168.100.109 '
HOST=0.0.0.0
USERNAME=root
PASSWORD=root
DATABASE=mystore2
@oliverlundquist
oliverlundquist / Makefile
Last active June 17, 2016 11:59
Docker Makefile
##
# Environment Variables
##
NAMESPACE=oliverlundquist
TAG=latest
NETWORK_NAME=mystore-api
REPO_PATH=~/repositories/mystoreno/mystore-api
NGINX_ID=`docker ps | grep $(NAMESPACE)/nginx:$(TAG) | cut -d ' ' -f1`
PHP_ID=`docker ps | grep $(NAMESPACE)/php7:$(TAG) | cut -d ' ' -f1`
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>.letter { position: absolute; font-size: 15px; }</style>
</head>
<body>
<div class="letter">k</div>
<div class="letter">u</div>
<div class="letter">r</div>