Skip to content

Instantly share code, notes, and snippets.

@romaricpascal
romaricpascal / modernizr.overflowscroll.js
Created January 11, 2012 21:22
A modernizr test to see if browser adds scrollbar on "overflow: scroll" elements
/**
* Test detecting if scrollbars are available
* on overflow-scroll elements.
*/
Modernizr.addTest('overflowscroll',function(){
var container = document.createElement('div');
container.style.cssText= 'height: 200px; width: 400px; overflow:scroll';
var content = document.createElement('div');
@romaricpascal
romaricpascal / manifest.pp
Created March 13, 2013 03:31
A Puppet manifest to create host entry, apache vhost and mysql database for PHP projects (eg. Wordpress projects)
# --------------------------------------------------------------------------
# Puppet manifest for wordpress projects:
# - Creates a host entry
# - Configures a vhost on an Apache server
# - Creates a database with a specific user
#
# The manifest relies on Hiera to access server specific information like
# the folder where the project is deployed or the database password.
#
# Apache configuration uses a fork of puppetlabs-apache module, available at
@romaricpascal
romaricpascal / host-entry.pp
Created March 15, 2013 13:09
A Puppet manifest snippet to add en try in the host file
# The host resource manages entries in the host file
# http://docs.puppetlabs.com/references/latest/type.html#host
host { 'awesome-project':
ensure => 'present',
name => 'awesome-project.local',
ip => '127.0.0.1'
}
@romaricpascal
romaricpascal / apache-vhost.pp
Created March 15, 2013 14:57
A Puppet manifest snippet to configure a Apache httpd vhost
# Apache configuration uses a fork of puppetlabs-apache module, available at
# https://github.com/rhumaric/puppetlabs-apache
#
# If you use the module from puppetlabs, be sure to remove
# - the `purge_vhosts_dir` parameter
# - the `setenv` parameter
# Makes sure apache is installed on the system. Leaves any vhost already
# deployed as it is.
class { 'apache':
# Makes sure MySQL is available on the server
class { 'mysql::server':
config_hash => {
'root_password' => 'OMG-The-r0ot-p@sSword-in-Pl@1n-T3xt'
}
}
# And creates the database
mysql::db {'awesome-project.local':
user => 'awesome-project',
@romaricpascal
romaricpascal / Gruntfile-connect.js
Created May 14, 2013 16:05
Sample configuration of the grunt-contrib-connect plugin for Grunt
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// grunt-contrib-connect will serve the files of the project
// on specified port and hostname
@romaricpascal
romaricpascal / Gruntfile-connect-open.js
Created May 14, 2013 16:18
Sample configuration of grunt-contrib-connect and grunt-open to serve your project and open a browser tab to the appropriate URL
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// grunt-contrib-connect will serve the files of the project
// on specified port and hostname
@romaricpascal
romaricpascal / Gruntfile-connect-open-livereload.js
Last active January 29, 2019 20:12
Sample configuration for grunt-contrib-connect, grunt-contrib-livereload and grunt-open
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// grunt-contrib-connect will serve the files of the project
// on specified port and hostname
@romaricpascal
romaricpascal / Gruntfile-livereload-regarde-connect-open.js
Last active December 17, 2015 08:08
Sample configuration to use livereload with regarde and connect so that your browser reloads its content each time it you save changes in your files
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// Configure Grunt
grunt.initConfig({
// grunt-contrib-connect will serve the files of the project
// on specified port and hostname
@romaricpascal
romaricpascal / test-shortcut.js
Created May 30, 2013 15:21
A little Mocha + Chai test to illustrate a blog post
describe('add()', function() {
it('Adds the character to the cast', function (){
var cast = new MovieCast([{name:'Mickey'},{name: 'Pluto'}]);
var newCharacter = {name:'Goofy'};
cast.add(newCharacter);
expect(cast.size()).to.equal(3);