Skip to content

Instantly share code, notes, and snippets.

View Plou's full-sized avatar

Plou Plou

View GitHub Profile
@Plou
Plou / npm-registry.md
Created February 18, 2014 08:52
Using the European npm mirror

Using the European npm mirror

To install :

npm install --registry http://registry.npmjs.org packagename

To keep using the European registry :

This will update your .npmrc to include the following line registry = http://registry.npmjs.eu/

npm config set registry http://registry.npmjs.eu

@Plou
Plou / .gitignore
Created February 18, 2014 17:10
Add the livereload snippet to a local typo3
[...]
typo3conf/ext/skin/ext_typoscript_setup_local.txt
@Plou
Plou / remoteAddr
Created February 25, 2014 08:53
Get remote address of a user in Javascript
$.getJSON('http://jsonip.com/?callback=', function(data){
console.log('Your ip is: ' + data.ip);
});
@Plou
Plou / identicon.js
Created March 3, 2014 09:03
Display an identicons from the last commit hash
var colors = require('colors');
var exec = require('child_process').exec;
exec('git rev-parse HEAD', function(error, stdout, stderr){
hash = process.argv[2] ? process.argv[2] : stdout
hash = hash.toString();
hash = hash.split('');
var identicons = '',
on = " ".zebra.inverse,
off = " ".green.inverse,
@Plou
Plou / Install.md
Created March 6, 2014 09:21
TYPO3 development environment with HomeBrew on OSX

PHP

brew install -v php --with-mysql --with-intl --with-fpm

brew install php55-intl

✩✩✩✩ PEAR ✩✩✩✩

If PEAR complains about permissions, 'fix' the default PEAR permissions and config: chmod -R ug+w /usr/local/Cellar/php55/5.5.9/lib/php

@Plou
Plou / googlemap.js
Last active January 22, 2018 00:31
Hide "points of interest" in google maps
styles = [
featureType: "poi",
elementType: "labels",
stylers: [
visibility: "off"
]
];
map = new google.maps.Map(document.getElementById('map-canvas'), {
disableDefaultUI: true,
@Plou
Plou / backbone.coffee
Created May 14, 2014 14:29
Track ajaxLoaded pages with google analytics Or plug it to backbone navigate method
# Override the navigate method to plug Ganalytics to it
originalLoadUrl = Backbone.History.prototype.loadUrl;
# This cleans up fragment the same way that loadUrl does as of Backbone 0.5.3
Backbone.History.prototype.loadUrl = (fragmentOverride) ->
fragment = this.fragment = this.getFragment(fragmentOverride)
console.log fragment, window.ga
if window.ga != undefined
@Plou
Plou / RulersSnippet.js
Created June 5, 2014 15:53
Snippet to help debuging scroll related scripts
Ruler = function (label, top, color, $container){
return $('<p class="ruler">'+label+'</p>').css({
"position": "absolute",
"width": "100%",
"margin": "0",
"padding": "0",
"border-top": "2px solid "+color,
"top": top,
"background": "rgba(255,255,255,.6)"
}).appendTo($container);
@Plou
Plou / Sources.md
Created June 18, 2014 13:09
Smart z-index management with SASS
@Plou
Plou / Events.coffee
Last active August 29, 2015 14:07
An standalone Event class from Backbone in coffeescript
# Create local references to array methods we’ll want to use later.
array = []
push = array.push
slice = array.slice
splice = array.splice
# (Backbone.)Events : A module that can be mixed in to any object in order to provide it with custom events. You may bind with on or remove with off callback functions to an event; trigger-ing an event fires all callbacks in succession.
class Events
# Bind an event to a `callback` function. Passing `"all"` will bind