Skip to content

Instantly share code, notes, and snippets.

Louis Teboul Androguide

Block or report user

Report or block Androguide

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Androguide
Androguide / tel-regex.js
Last active Oct 21, 2015
French phone number regex
View tel-regex.js
var regex = new RegExp(/^[+](\d{3})\)?(\d{3})(\d{5,6})$|^(\d{10,10})$/);
regex.test('0612345678') // true
regex.test('06123456789') // false
regex.test('+33612345678') // true
regex.test('+330612345678') // true
regex.test('+3306123456789') // false
@Androguide
Androguide / uuid4.js
Created Oct 13, 2015
Generates a v4 UUID according to the spec
View uuid4.js
my.uuid4 = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, my._uuid4);
};
// Cache callback to optimize perf
my._uuid4 = function(cc) {
var rr = Math.random() * 16 | 0; return (cc === 'x' ? rr : (rr & 0x3 | 0x8)).toString(16);
};
@Androguide
Androguide / BinaryTranslator.js
Created Sep 24, 2015
Converts decimal to binary and outputs a table of the powers of 2 for manual conversion
View BinaryTranslator.js
(function () {
"use strict";
window.BinaryTranslate = function (number) {
var binaryTable = [[], []];
var master = number;
var neighbour = nearestPowerOf2(number);
for (var i = neighbour; i >= 0; i--) {
binaryTable[0].push(Math.pow(2, i));
binaryTable[1].push(master - Math.pow(2, i) >= 0 ? 1 : 0);
@Androguide
Androguide / blackorwhite.js
Last active Sep 4, 2015
Get black or white color depending on background color for best readability. Based on the YIQ color-space contrast ratio.
View blackorwhite.js
function blackOrWhite(hexcolor) {
var color = hexcolor.substring(1);
hexcolor = color.length < 5 ? color + color : color;
var r = parseInt(hexcolor.substr(0, 2), 16);
var g = parseInt(hexcolor.substr(2, 2), 16);
var b = parseInt(hexcolor.substr(4, 2), 16);
var yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
return (yiq >= 125) ? '#333' : '#eee';
}
@Androguide
Androguide / ng-ie9.js
Created Jan 14, 2015
AngularJS fix for IE9
View ng-ie9.js
window.console = window.console || {};
window.console.log = window.console.log || function() {};
@Androguide
Androguide / bs-carousel.coffee
Last active Aug 29, 2015
Angular directive to encapsulate the Bootstrap carousel component: http://getbootstrap.com/javascript/#carousel
View bs-carousel.coffee
@Androguide
Androguide / bugdroid.html
Last active Aug 29, 2015
An Android mascot built with CSS
View bugdroid.html
<!DOCTYPE html>
<html>
<head>
<title>CSS Bugdroid</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
padding: 40px;
View watch.html
<!DOCTYPE html>
<html>
<head>
<title>CSS WATCH</title>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
background: #00bad2;
@Androguide
Androguide / paper-input.js
Created Jul 11, 2014
A directive providing native AngularJS 2-way data-binding support for Polymer's <paper-input> component
View paper-input.js
'use strict';
// Paper Input Directive
// ---------------------
// The AngularJS directive allowing to bind to Polymer's `<paper-input>` elements
// with Angular like they were standard HTML5 `<input>` elements, using the `ng-model` attribute
angular.module('Androguide').directive('paperInput', ['$parse', '$timeout', '$browser', function ($parse, $timeout, $browser) {
return {
restrict: 'E',
@Androguide
Androguide / init.environ.rc.in
Created Apr 19, 2014
PAC Rom support in /system/core/rootdir/init.environ.rc.in
View init.environ.rc.in
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework-pac.jar:/system/framework/framework2.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/webviewchromium.jar:/system/framework/telephony-msim.jar
You can’t perform that action at this time.