Skip to content

Instantly share code, notes, and snippets.

View vnys's full-sized avatar

Victor Nystad vnys

View GitHub Profile
@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 / 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.
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 / 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 {
@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 / streams.js
Last active February 2, 2016 13:04
streams
const stream = require('stream');
let readable = new stream.Readable({
objectMode: true,
read: function() {
let arr = [ { a: 1 }, { b: 1 }, { c: 1 } ];
arr.forEach( item => { this.push(item) });
this.push(null);
}
}).on('end', function() {
@vnys
vnys / tmux-cheatsheet.markdown
Last active March 2, 2016 10:41 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vnys
vnys / aa.md
Last active April 25, 2016 14:09
Plussicon

Original

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 31 31" style="enable-background:new 0 0 31 31;" xml:space="preserve">
<style type="text/css">
	.st0{fill:#FFFFFF;}
</style>
@vnys
vnys / validate.js
Last active April 21, 2016 15:39
Node validation with Joi, only allow env if ext eq json
'use strict';
const Joi = require('joi');
module.exports.env = Joi.when( 'ext', { is: 'json', then: Joi.boolean().optional().default(false), otherwise: Joi.forbidden() } );
module.exports.ext = Joi.string().regex(/^(json|html)$/).lowercase().trim().required();
module.exports.debug = Joi.object({
env: this.env,
ext: this.ext
@vnys
vnys / auto-deploy.md
Created May 7, 2016 04:38 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.