Skip to content

Instantly share code, notes, and snippets.

View VincentHelwig's full-sized avatar
🏠
Working from home

Vincent Helwig VincentHelwig

🏠
Working from home
View GitHub Profile
[user]
name = xxx
email = xxx@domain
[push]
# Default push should only push the current branch to its push target, regardless of its remote name
default = upstream
# When pushing, also push tags whose commit-ishs are now reachable upstream
followTags = true
[color]
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main =
Html.beginnerProgram { model = model, view = view, update = update }
-- MODEL
@VincentHelwig
VincentHelwig / push.js
Last active August 29, 2015 14:22
Cordova PushPlugin
var app = angular.module('pushApp');
app.run(function(PushFactory) {
document.addEventListener('deviceready', function () {
PushFactory.init();
});
});
app.factory('PushFactory', ['CONFIG', '$http', function(CONFIG, $http) {
'use strict';
// FROM : http://playground.deaxon.com/js/vanilla-js/
// and complement : http://putaindecode.fr/posts/js/de-jquery-a-vanillajs/
Events
$(document).ready(function() { }); document.addEventListener("DOMContentLoaded", function() { });
$("a").click(function() { }) [].forEach.call(document.querySelectorAll("a"), function(el) {
el.addEventListener("click", function() {});
});
Selectors
<a href="mailto:mail@hostname.com">Email</a>
<a href="tel:01234567890">Phone Number</a>
<a href="callto:01234567890">Skyper Number</a>
@VincentHelwig
VincentHelwig / gist:c59015404272b6b310b3
Last active August 29, 2015 14:08
Art-ev Friday Tech
**History**
http://en.wikipedia.org/wiki/File:Mosaic_Netscape_0.9_on_Windows_XP.png
http://dailyjs.com/2010/05/24/history-of-javascript-1/
http://dailyjs.com/2010/05/31/history-of-javascript-2/
http://dailyjs.com/2010/06/07/history-of-javascript-3/
...
** How browsers work **
http://taligarsiel.com/Projects/howbrowserswork1.htm
@VincentHelwig
VincentHelwig / gist:5f5152fce47953e866f3
Last active August 29, 2015 14:08
Console log Fallback
var console = console || {
log: function( ){ },
info: function( ){ },
warn: function( ){ },
table: function( ){ }
};
@VincentHelwig
VincentHelwig / gist:a6900c85b4e1365e331e
Created November 5, 2014 16:44
Quick Drush Uninstall/Reinstall of a Custom Module
drush pm-disable mymodule
drush pm-uninstall mymodule
drush pm-enable mymodule
@VincentHelwig
VincentHelwig / gist:aba7b628b1205599dba7
Created November 5, 2014 11:46
Optimised retrieve offset in vanilla js
// FROM http://jsperf.com/test-offset-jquery-vs-vanilla
function offset(elt) {
var rect = elt.getBoundingClientRect(), bodyElt = document.body;
return {
top: rect.top + bodyElt .scrollTop,
left: rect.left + bodyElt .scrollLeft
}
}
var offsetElt = offset(document.getElementById('element'));
// FROM http://jsperf.com/compare-array-unique-versions/4
Array.prototype.getUnique = function () {
var arr = this;
var newArr = [],
i = 0,
j = 0,
obj = {},
len = arr.length;
while (len--) {
if (!obj[arr[i]]) {