Skip to content

Instantly share code, notes, and snippets.

@kevboutin
kevboutin / hapi-lifecycle-events.js
Created February 26, 2016 21:34
Shows how to use hapi to extend lifecycle events within node.
'use strict';
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({ port: 8000 });
// test by using this on command line:
// http GET localhost:8000
server.ext('onRequest', (request, response) => {
console.log('onRequest');
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active June 23, 2024 21:35
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@agendor
agendor / hapijs-rest-api-tutorial.md
Last active August 31, 2021 08:31
A practical introduction to building a RESTful API with the hapi.js server framework for Node.js
@ruionwriting
ruionwriting / Logger.php
Last active December 20, 2015 13:29
Easy to use logging class for PHP taken from Chris Valleriani blog article.
<?php
/**
* +90% based on the article of Chris Valleriani
* http://chrisvall.com/coding/php-easy-to-use-logging-class-for-your-scripts
*
* My changes:
*
* - force default timezone;
* - defines a base dir for log files output
@ruionwriting
ruionwriting / PHP_I18N_basics.md
Last active December 20, 2015 13:29
Basics for setting up localized PHP applications using gettext functions.

Overview

Localizing/internationalizing any PHP application is easy through gettext functions. Basically you'll have a set of localization files (*.po) that have a binary format version (*.mo) across a simple and standard directory structure. Then gettext functions will use existing binary files based on current language locale.

Directory structure and localization files

locale/
├── en_US
│   └── LC_MESSAGES
@christoomey
christoomey / gist:1238761
Created September 24, 2011 00:12
nginx management script
#! /bin/sh
### BEGIN INIT INFO
#
# Source https://raw.github.com/jnstq/rails-nginx-passenger-ubuntu/master/nginx/nginx
#
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6