Skip to content

Instantly share code, notes, and snippets.

View vnys's full-sized avatar

Victor Nystad vnys

View GitHub Profile
@vnys
vnys / reverse.js
Created January 11, 2016 13:05
Reverse text on webpage
(function(body) {
var text = [],
treewalker = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, null, false);
while(treewalker.nextNode()) {
if (treewalker.currentNode.nodeValue.charAt(0) !== '\n') {
text.push(treewalker.currentNode);
}
};
@vnys
vnys / cors.nginxconf
Created January 6, 2016 14:34 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
git clone git://github.com/wbond/sublime_package_control.git Package\ Control
cd Package\ Control
git checkout python3
# restart Sublime Text 3 and you should have Package Control working
@vnys
vnys / star-new.svg
Created December 4, 2015 09:02
star
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vnys
vnys / weekendCustomFormula.md
Created December 3, 2015 16:25
google spreadsheets

How to add background colour to weekends in a vertical calendar

Apply to range: A2:D176 Custom formula: =OR(WEEKDAY($A:$A)=7, WEEKDAY($A:$A)=1)

@vnys
vnys / css-nesting.md
Last active December 1, 2015 08:21
css-nesting

###css nesting polyfill

Input

.main {
	@nest & a {
		text-decoration: none;
	}
}
@vnys
vnys / exiftool.md
Last active October 14, 2016 05:51
exiftool

Navngi filer med samme konvensjon som brukes av DropBox i Camera Upload.

cd <photo-directory>
exiftool "-FileName<CreateDate" -d "%Y-%m-%d %H.%M.%S%%-c.%%le" .
@vnys
vnys / cellar.svg
Last active November 11, 2015 20:55
Cellar
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vnys
vnys / regex.js
Created November 8, 2015 08:41
Treningslog regex
'3 x 10 x 10 min 2kg '.match(/(\d+\s?[x|min|kg]+)/g).forEach(match => console.log(match.replace(/\s/,'').match(/(\d+)(\w+)/)))
@vnys
vnys / draft.md
Created November 7, 2015 21:49 — forked from jsvine/draft.md
Why I love Tabletop.js but don't use it in production

Tabletop.js is a fantastic, open-source JavaScript library that lets developers easily integrate data from Google Spreadsheets into their online projects. I've used it, even contributed a minor feature, and love it for prototyping. Non-programmers love being able to update a project via Google Spreadsheets' hyper-intuitive interface.

That said, I'm extraordinarily wary of using Tabletop in production. Instead, at the Wall Street Journal, we use a bit of middleware to "prune" our Google Spreadsheets-based data and then cache it on our own servers. A few brief reasons: