Skip to content

Instantly share code, notes, and snippets.

View sorenlouv's full-sized avatar

Søren Louv-Jansen sorenlouv

View GitHub Profile
@sorenlouv
sorenlouv / Sublime Text Keymappings
Created July 11, 2013 23:23
My default keymappings for Sublime Text: - Toggle sidebar - Refresh sidebar - Search through files
[
{ "keys": ["super+b"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+r"], "command": "refresh_folder_list" },
{ "keys": ["alt+space"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }
]
@sorenlouv
sorenlouv / Sublime Text Preferences
Last active December 19, 2015 15:58
My Sublime Text Preferences.Tab size, trim trailing white space etc.
{
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
"fade_fold_buttons": false,
"folder_exclude_patterns": [
".svn",
".git",
".hg",
"CVS",
"auditlog",
"i18n",
@sorenlouv
sorenlouv / tesseract-wconf.patch
Last active December 20, 2015 20:39
Adds confidence parameter for Tesseract Can be added to Homebrew Formula: /usr/local/Library/Formula/tesseract.rb Read more about Homebrew patches: https://github.com/mxcl/homebrew/wiki/Formula-Cookbook#patches
--- /api/baseapi.cpp
+++ /api/baseapi.cpp
@@ -1041,6 +1041,7 @@
hocr_str->add_str_int(" ", top);
hocr_str->add_str_int(" ", right);
hocr_str->add_str_int(" ", bottom);
+ hocr_str->add_str_int("; x_wconf ", ((LTRResultIterator*)it)->Confidence(level));
*hocr_str += "\">";
}
@sorenlouv
sorenlouv / clean-repos.sh
Last active August 29, 2015 13:57
Tradeshift: Update all repos, fix pom and clean
# Run the following in the folder containing all ts repos.
# Git pull
for dir in */; do
cd $dir
echo "Opening ${dir} and git pull"
git pull
cd ..
done
@sorenlouv
sorenlouv / angular-performance.js
Last active August 29, 2015 14:01
Performance bookmarklet for Angularjs
var bindings = document.getElementsByClassName('ng-binding').length;
var scopes = document.getElementsByClassName('ng-scope').length;
var bodyScope = angular.element(document.querySelector('body')).scope();
var watchers = bodyScope && bodyScope.$$watchers ? bodyScope.$$watchers.length : '?';
var getWatchers = function () {
var root = document.getElementsByTagName('body')[0];
var numberOfWatches = 0;
@sorenlouv
sorenlouv / squash-commits.sh
Last active October 30, 2015 09:50
Squash commits from branch
git checkout master
git checkout -b master-squash
git merge --squash <branch-to-squash>
@sorenlouv
sorenlouv / tradeshift.zsh
Created October 23, 2014 23:20
Tradeshift shell configuration
# TS home folder
export TS_HOME=~/ts-code/
# tell Maven where Java7 is
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
# Riak needs at least a ulimit of 4096
ulimit -n 10240
# Increase allowed memory consumption for Maven
@sorenlouv
sorenlouv / grunt-test.md
Last active August 29, 2015 14:17
Grunt node debugging

Start grunt

cd ~/ts-code/Apps-Server/

/usr/local/bin/node --debug-brk=52713 --debug-port=5858 --nolazy /usr/local/bin/grunt server

Start node inspector

node-inspector --web-port=9090

Open Developer tools

@sorenlouv
sorenlouv / cpu-intensive.js
Last active December 19, 2023 06:00
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
}
mySlowFunction(8); // higher number => more iterations => slower
{
"app": {
"redirect_uri": "http://requestb.in/zqe6mrzq",
"main": "http://localhost:8889/tradeshift-proxy/auth/login?response_type=code&client_id=sqren.sqrentest&redirect_uri=http://requestb.in/zqe6mrzq&scope=openid offline"
},
"tradeshift_version": "5.0",
"default_locale": "en-GB",
"locales": {
"en-GB": {
"app_desc": "This is a test by sqren",