Skip to content

Instantly share code, notes, and snippets.

View manekinekko's full-sized avatar
:octocat:
Check me out on Twitter @manekinekko

Wassim Chegham manekinekko

:octocat:
Check me out on Twitter @manekinekko
View GitHub Profile
@manekinekko
manekinekko / find_pattern.js
Last active August 29, 2015 14:05
The purpose of this algorithm is to tell if a given pattern is found in a list of patterns. In this example, we're trying to find the pattern [2,3,6] in a "commands" array. This algorithm uses a threshold value to ignore certain patterns.
(function(){
var threshold = 6;
var service = {
isCommandEntered: function isCommandEntered(commands, commandToFind){
return commands.map(function(value, index, self){
var n=1;
while(self[++index]===value) ++n;
return {command: value, weight: n};
})
.filter(function(value, index, self){
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@manekinekko
manekinekko / credit_agricole_auto_login.js
Last active August 29, 2015 14:12
Ceci est une preuve de concept (PoC) d'une connexion automatisée sur votre compte Crédit Agricole.
// Mentions légales :
// Ce code est utilisé dans un but d'exemple et de sensibilitation UNIQUEMENT.
// J'espère grâce à cet exemple que Crédit Agricole va sécuriser un peu plus cette phase de connexion ^^
// Exemple 1
// Pour accéder directement au formulaire de connexion, Utilisez ce lien.
window.location.href="https://www.illeetvilaine-g4-enligne.credit-agricole.fr/stb/entreeBam?TOP_ORIGINE=V&vitrine=O&largeur_ecran=800&hauteur_ecran=600&origine=vitrine&situationTravail=BANQUAIRE&canal=WEB&typeAuthentification=CLIC_ALLER&urlOrigine=http://www.ca-illeetvilaine.fr&tracking=O";
// Exemple 2
@manekinekko
manekinekko / server_router.ts
Last active August 29, 2015 14:27
A proposal for universal/server_router module.
/// <reference path="../typings/tsd.d.ts" />
import {Injectable, bind} from 'angular2/di';
// error TS2307: Cannot find module 'angular2/src/router/location_strategy'.
import {LocationStrategy} from 'angular2/src/router/location_strategy';
class MockServerHistory implements History {
length: number;
state: any;
@manekinekko
manekinekko / cordova-batch-install-plugins.sh
Created August 13, 2015 14:34
This script uses the `plugins/fetch.json` cordova file to batch install all the required plugins at once.
#!/usr/bin/env node
//this hook installs all your plugins
// add your plugins to this list--either
// the identifier, the filesystem location
// or the URL
var plugins = require('./plugins/fetch.json');
var pluginlist = [];
@manekinekko
manekinekko / ng2.index.html
Created August 19, 2015 22:38
ng2 bootstrap file
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // some internal d3 functions do not "like" the "this" keyword, hence setting a local variable
this.configure = function(configuration)
{
this.config = configuration;
@manekinekko
manekinekko / AngularJS-Service-Observer-Pattern-in-ES6.js
Last active January 26, 2016 13:40
This is an implementation of Service Observer Pattern in AngularJS (1.x) using ES6.
export var ObserverService = (function(){
// MUST be an object
var data = {};
return class ObserverService {
constructor () {}
api() {
@manekinekko
manekinekko / MyModule.ts
Created March 13, 2016 21:27
Typescript and AngularJs 1.x
export let MyModule = angular.module('MyModule', []);
@manekinekko
manekinekko / angular2-beta3-to-rc1.md
Last active May 26, 2016 19:51
Migration Angular 2 apps from (old) Beta 3 to RC1

1) update package.json

"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",