Skip to content

Instantly share code, notes, and snippets.

Søren Louv-Jansen sqren

Block or report user

Report or block sqren

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sqren
sqren / Sublime Text Keymappings
Created Jul 11, 2013
My default keymappings for Sublime Text: - Toggle sidebar - Refresh sidebar - Search through files
View Sublime Text Keymappings
[
{ "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} }
]
@sqren
sqren / Sublime Text Preferences
Last active Dec 19, 2015
My Sublime Text Preferences.Tab size, trim trailing white space etc.
View Sublime Text Preferences
{
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
"fade_fold_buttons": false,
"folder_exclude_patterns": [
".svn",
".git",
".hg",
"CVS",
"auditlog",
"i18n",
@sqren
sqren / tesseract-wconf.patch
Last active Dec 20, 2015
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
View tesseract-wconf.patch
--- /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 += "\">";
}
@sqren
sqren / clean-repos.sh
Last active Aug 29, 2015
Tradeshift: Update all repos, fix pom and clean
View clean-repos.sh
# 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
@sqren
sqren / angular-performance.js
Last active Aug 29, 2015
Performance bookmarklet for Angularjs
View angular-performance.js
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;
@sqren
sqren / squash-commits.sh
Last active Oct 30, 2015
Squash commits from branch
View squash-commits.sh
git checkout master
git checkout -b master-squash
git merge --squash <branch-to-squash>
@sqren
sqren / tradeshift.zsh
Created Oct 23, 2014
Tradeshift shell configuration
View tradeshift.zsh
# 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
@sqren
sqren / grunt-test.md
Last active Aug 29, 2015
Grunt node debugging
View grunt-test.md

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

@sqren
sqren / cpu-intensive.js
Last active Jan 2, 2020
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
View cpu-intensive.js
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
View Example manifest for Tradeshift
{
"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",
You can’t perform that action at this time.