Skip to content

Instantly share code, notes, and snippets.

View OlivierPerceboisGarve's full-sized avatar

Olivier Percebois-Garve OlivierPerceboisGarve

View GitHub Profile
@OlivierPerceboisGarve
OlivierPerceboisGarve / mouse-plugin.js
Created September 6, 2019 11:47 — forked from OrganicPanda/mouse-plugin.js
Track the mouse position in Protractor
// Hook in to `addEventListener` to track the mouse and display it as a circle
exports.onPageLoad = function() {
return browser.executeScript(function() {
(function() {
var EventSniffer = function() {
this.history = [];
this.callbacks = {};
this.minCacheSize = 100;
this.maxCacheSize = 500;
};
@OlivierPerceboisGarve
OlivierPerceboisGarve / ES6 Angular Directive with injection
Created March 25, 2017 20:41 — forked from royto/ES6 Angular Directive with injection
Example of Angular Directive as ES6 class with injection
class myDirective {
constructor(userService) {
this.template = `<div>{{fullName}}</div>`;
this.restrict = 'E';
this.scope = {
user: '='
};
this.link = function(scope, element) {
scope.fullName = userService.getFullName(scope.user);
};
@OlivierPerceboisGarve
OlivierPerceboisGarve / SassMeister-input.scss
Created August 3, 2015 10:14
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@mixin foobar() {
@if & == span {
outline: 1px solid red;
} @else {
outline: 1px solid blue;
console.highlight = function(text, sample) {
var escapedSample = sample.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var reSample = new RegExp(escapedSample, 'g');
var args = [''];
var highlightedText = text.replace(reSample, function(match) {
args.push('background-color: #ffc', 'background-color: none');
return '%c' + match + '%c';
});
args[0] = highlightedText;
console.log.apply(console, args);
@OlivierPerceboisGarve
OlivierPerceboisGarve / gist:1257535
Created October 2, 2011 15:21
node www/node_modules/socket.io/examples/chat/app.js
olivvv@olivvv-VirtualBox:~$ node www/node_modules/socket.io/examples/chat/app.js
node.js:207
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.<anonymous> (module.js:376:11)
at Object.<anonymous> (/home/olivvv/www/node_modules/socket.io/examples/chat/app.js:6:8)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
@OlivierPerceboisGarve
OlivierPerceboisGarve / gist:1257460
Created October 2, 2011 13:37
npm install error
olivvv@olivvv-VirtualBox:~/node$ curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6349 100 6349 0 0 5031 0 0:00:01 0:00:01 --:--:-- 9707
tar=/bin/tar
version:
tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
/*!
* $imple cache - v0.3pre - 07/15/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,window){
(function(s,c,r,i,j){
var out = '', props = [], selector = '';
for(var i=0, ilen=s.length; i<ilen; i++){
c=s[i].cssRules;
for(var j=0,len=c.length; j<len; j++){
r=c[j].cssText;
props.push(r.split('{'));
//console.log('document.styleSheets['+i+'].cssRules['+j+'].cssText = "'+r+'";')
//out+= r+'<br>';
}