Skip to content

Instantly share code, notes, and snippets.

View kuddl's full-sized avatar
💭
coding away

Tobias Sailer kuddl

💭
coding away
View GitHub Profile
@codediodeio
codediodeio / index.js
Created June 28, 2017 15:54
Firebase Cloud Functions image thumbnail generator using Sharp for 4x faster resizing
const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const sharp = require('sharp')
const _ = require('lodash');
const path = require('path');
const os = require('os');
exports.generateThumbnail = functions.storage.object('uploads/{imageId}').onChange(event => {
const object = event.data; // The Storage object.
@danharper
danharper / CatchAllOptionsRequestsProvider.php
Last active April 20, 2024 01:53
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 2, 2024 12:46
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@photopresentr
photopresentr / har2siege.js
Created December 15, 2013 16:04
Convert HAR Archive to Siege URL List using node.js
#!/usr/bin/env node
/*
* har2siege.js
* converts a HAR file generated by chrome to an url file as required
* by the siege performance testing tool (http://www.joedog.org/siege-home/)
*
* Usage:
* - save har file in chrome. make sure extension is .json, e.g. myrequests.json
* - put the relative path as the only parameter on the command line
* - redirect STDOUT to the file you want as the urllist for siege
@pmeenan
pmeenan / user-timing-rum.js
Last active January 18, 2024 23:46
Support routine for adding W3C user timing events to a site. Includes some basic polyfill support for browsers that don't support user timing or navigation timing (though the start time for non-navigation timing support could be improved with IE < 9 to use IE's custom start event).
// Support routines for automatically reporting user timing for common analytics platforms
// Currently supports Google Analytics, Boomerang and SOASTA mPulse
// In the case of boomerang, you will need to map the event names you want reported
// to timer names (for mPulse these need to be custom0, custom1, etc) using a global variable:
// rumMapping = {'aft': 'custom0'};
(function() {
var wtt = function(n, t, b) {
t = Math.round(t);
if (t >= 0 && t < 3600000) {
// Google Analytics
@codejoust
codejoust / compile_site.js
Created February 15, 2012 04:13
Nodejs Static Site Builder / Watcher - Jade/Styl -> HTML/CSS
var stylus = require('stylus'),
jade = require('jade'),
fs = require('fs');
function compile_jade(){
console.log('compiling html index');
var fn = jade.compile(fs.readFileSync('index.jade', 'utf8'), {pretty: true});
if (fn){
fs.writeFileSync('index.html', fn());
} else {
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh