Skip to content

Instantly share code, notes, and snippets.

View SindreSvendby's full-sized avatar

Sindre Svendby SindreSvendby

View GitHub Profile
@SindreSvendby
SindreSvendby / README.md
Last active September 27, 2016 21:43
in-view (fork to support multiple instances)

Example of usage of in-view fork

browserify

browserify index.js > bundle.js

Start the server

php -S localhost:8080

@SindreSvendby
SindreSvendby / folder-size-cloudinary.js
Created August 24, 2016 09:29
Report the size of a folder in cloudinary (below upload)
// npm install cloudinary
const cloudinary = require('cloudinary');
const folder_in_upload = process.env.FOLDER
cloudinary.config({
cloud_name: process.env.CLOUD_NAME,
api_key: process.env.API_KEY,
api_secret: process.env.API_SECRET
});
@SindreSvendby
SindreSvendby / promise-example-return-reject.markdown
Created August 8, 2016 13:23
promise example return Reject.
@SindreSvendby
SindreSvendby / performance.now.polyfill.js
Created July 8, 2016 10:52 — forked from yesasha/performance.now.polyfill.js
performance.now() and performance.timing.navigationStart polyfill
// performance.now() and performance.timing.navigationStart polyfill
if (!window.performance) {
window.performance = {};
}
if (!performance.now) {
performance.now = function () {
return Date.now() - this.timing.navigationStart;
}
}
@SindreSvendby
SindreSvendby / performance.now()-polyfill.js
Last active July 8, 2016 11:00 — forked from paulirish/performance.now()-polyfill.js
performance.now() polyfill (aka perf.now())
// @license http://opensource.org/licenses/MIT
// copyright Paul Irish 2015
// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill
// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
# Send in urls as arguments, this
# script will loop over the arguments and do 100 request to each url
# it will report the Average time to first byte for each site.
LOOP=100;
for SITE in "$@"
do
echo "Requesting $SITE $LOOP times ...";
SUM=0;
for i in $(seq 1 $LOOP)
do
@SindreSvendby
SindreSvendby / .i3config
Created December 4, 2015 09:27
My i3 config
xrandr --output DP1 --auto --left-of LVDS1
@SindreSvendby
SindreSvendby / removeLogentires.sh
Created November 30, 2015 16:52
remove all logentries drains setup in heroku.
#!/bin/bash
for app in `heroku list | grep [a-z] | cut -d " " -f 1`; do
for logDrains in `heroku drains -a $app 2>/dev/null | grep ^syslog`; do
if [[ $logDrains == *"logentries"* ]]; then
echo "`heroku drains:remove $logDrains -a $app` for $app";
else
echo "Skipping $logDrains"
fi
done
@SindreSvendby
SindreSvendby / ceadar-test.js
Created October 14, 2015 21:39
Test to check if some of the apps I have is on the old cedar platform in heroku
// The legacy Cedar-10 stack has been deprecated and will reach its end-of-life on November 4, 2015.
// To see if some of your apps is old;
// HEROKU_API_TOKEN="<YOUR_HEROKU_TOKEN_HERE>" node ceadar-test.js
const Heroku = require('heroku-client');
const hl = require('highland');
var hk = new Heroku({
token: process.env.HEROKU_API_TOKEN
});
// Dumps all headers
// My usages is to test what headers Cloudfront is setting. Used together with ngrok for me.
//start script:
// npm install
// node headers.js
var express = require('express');
var app = express();