This file contains hidden or 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
# List all queries that are running longer than one minute | |
SELECT | |
pid, | |
now() - pg_stat_activity.query_start AS duration, | |
query, | |
state | |
FROM pg_stat_activity | |
WHERE (now() - pg_stat_activity.query_start) > interval '1 min' | |
ORDER BY duration; |
This file contains hidden or 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 moviePilotRatingAnalyser = { | |
movieId: function () { | |
return jQuery("[data-type='Movie']").data('id'); | |
}, | |
ratings: function () { | |
return this.ratingData.map(function (rating) { | |
return rating.value || 0; | |
}); | |
}, | |
average: function () { |
This file contains hidden or 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 | |
JAVA_FILE_ENDING="*.java" | |
JAVA_MARKER="\/* TODO: Check for data center *\/" | |
DIRECTORY=$1 | |
if [ -z "$DIRECTORY" ]; then | |
echo "Usage: $0 <directory>" |
This file contains hidden or 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
COMPONENT_NAME=timepicker | |
GREP_E_MATCHER="(timepicker|other_string)" | |
TMP_BRANCH=$COMPONENT_NAME-tmp | |
git checkout -b $TMP_BRANCH | |
git filter-branch -f --prune-empty --index-filter 'git ls-files | grep -v -E "$GREP_E_MATCHER" | xargs git rm --cached --ignore-unmatch --quiet' HEAD | |
git checkout --orphan $COMPONENT_NAME |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Bash script to setup headless Selenium (uses Xvfb and Chrome) | |
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04 | |
# Add Google Chrome's repo to sources.list | |
sudo add-apt-repository ppa:chromium-daily/stable | |
sudo apt-get update | |
#echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list |
This file contains hidden or 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 analyseScopeAndWatchers() { | |
// fetch all elements with ng-scope class | |
var scopeElements = Array.prototype.slice.apply(document.querySelectorAll(".ng-scope")); | |
// map elements to scopes | |
var scopes = scopeElements.map(function (element) { | |
return angular.element(element).scope(); | |
}); | |
// filter duplicated scopes created by ng-view |
This file contains hidden or 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 interceptFunction (object, fnName, options) { | |
var noop = function () {}; | |
var fnToWrap = object[fnName]; | |
var before = options.before || noop; | |
var after = options.after || noop; | |
object[fnName] = function () { | |
before.apply(this, arguments); | |
var result = fnToWrap.apply(this, arguments); | |
after.apply(this, arguments); |
This file contains hidden or 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 interceptFunction (object, fnName, options) { | |
var noop = function () {}; | |
var fnToWrap = object[fnName]; | |
var before = options.before || noop; | |
var after = options.after || noop; | |
object[fnName] = function () { | |
before.apply(this, arguments); | |
var result = fnToWrap.apply(this, arguments); | |
after.apply(this, arguments); |
This file contains hidden or 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 scopeElements = Array.prototype.slice.apply(document.querySelectorAll(".ng-scope")); | |
var scopes = scopeElements.map(function (element) { | |
return angular.element(element).scope(); | |
}); | |
var scopeIds = scopes.map(function(scope) { | |
return scope.$id; | |
}); | |
var uniqueScopeIds = scopeIds.filter(function(scopeId, index){ | |
return scopeIds.indexOf(scopeId) === index; | |
}); |
NewerOlder