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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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 remote rename origin bitbucket | |
git remote add origin {new repo url} | |
git push origin --all | |
$ git remote rm bitbucket |
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
-- Etch-a-sketch with Elm | |
-- Paste this code into http://elm-lang.org/try | |
-- Use the arrow keys to draw a line etch-a-sketch style | |
import Color exposing (..) | |
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
import Keyboard | |
import Time exposing (fps) |
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 React = require('react'); | |
const connectToStores = require('flummox/connect'); | |
function connect(...args) { | |
return function(target) { | |
return connectToStores(target, ...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
/** | |
* injectable | |
* | |
* Provides a constructor to move items from the $inject property to local object members. | |
* | |
* inject = ['$q', '$http'] //translates to | |
* | |
* this.$q | |
* this.$http | |
*/ |
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
What is the output of this function? Why? | |
for(var i = 0; i < 5; i++) { | |
setTimeout(function() { | |
console.log('The value of i is ', i); | |
}, 500); | |
} |
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 serialize = function(obj, prefix) { | |
var str = []; | |
for(var p in obj) { | |
var k = prefix ? prefix + "[" + p + "]" : p, v = obj[p]; | |
str.push(typeof v == "object" ? | |
serialize(v, k) : | |
encodeURIComponent(k) + "=" + encodeURIComponent(v)); | |
} | |
return str.join("&"); | |
} |