Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Vincent Loy VincentLoy

🏠
Working from home
Block or report user

Report or block VincentLoy

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
View bitcolor.js
// convert 0..255 R,G,B values to binary string
RGBToBin = function(r,g,b){
var bin = r << 16 | g << 8 | b;
return (function(h){
return new Array(25-h.length).join("0")+h
})(bin.toString(2))
}
// convert 0..255 R,G,B values to a hexidecimal color string
RGBToHex = function(r,g,b){
@VincentLoy
VincentLoy / foundation_v5_pagination.html.twig
Last active Aug 29, 2015
Foundation 5 Sliding pagination control implementation for KnpPaginationBundle for Symfony 2
View foundation_v5_pagination.html.twig
{#
/**
* @file
* Foundation 5 Sliding pagination control implementation.
*
* View that can be used with the pagination module
* from the Foundation 5 CSS Toolkit
* http://foundation.zurb.com/docs/components/pagination.html
* is made to work with knppaginationbundle for symfony 2
* http://knpbundles.com/KnpLabs/KnpPaginatorBundle
View materialDesignShadowHelper.less
/**
* A mixin which helps you to add depth to elements according to the Google Material Design spec:
* http://www.google.com/design/spec/layout/layout-principles.html#layout-principles-dimensionality
*
* Please note that the values given in the specification cannot be used as is. To create the same visual experience
* the blur parameter has to be doubled.
*
* Author: Florian Kutschera (@gefangenimnetz), Conceptboard GmbH (@conceptboardapp)
*
* Example usage:
@VincentLoy
VincentLoy / snippet.less
Created Apr 4, 2015
less / css - snippets
View snippet.less
// ===========================================
// ABSTRACT CLASSES
// ===========================================
.BoxShadowHelper(@level: 1){
& when (@level = 1) {
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
& when (@level = 2) {
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
View mailchimp.snippet.php
<?php
/**
* Created by PhpStorm.
* User: Vincent
* Date: 05/04/2015
* Time: 12:46
*/
$apiKey = 'your-api-key';
$listId = 'your-list-id';
$email = $_POST['email'];
@VincentLoy
VincentLoy / cacert.pem
Last active Aug 29, 2015 — forked from planetoftheweb/tweets_json.php
easly display tweet
View cacert.pem
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla as of: Wed Feb 25 04:12:04 2015
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt). This file can be found in the mozilla source tree:
## http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
##
View humidex.py
# t is temperature in °C
# d is dew Point Temperature in °C
import math
def get_humidex(t, d):
kelvin = 273.15
temperature = t + kelvin
dewpoint = d + kelvin
View scrollTo.js
$element.click(function (e) {
e.preventDefault();
var page,
speed;
page = $(this).attr('href');
speed = 750;
$('html, body').animate({
scrollTop: $(page).offset().top
@VincentLoy
VincentLoy / monty_hall.py
Created Jun 25, 2015
Test with the Monty Hall problem
View monty_hall.py
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
#
# monty-hall-problem
# copyright (c) 2015 Vincent Loy
# Vincent Loy <vincent.loy1@gmail.com>
import random
class MontyHall:
def __init__(self):
View repair.py
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
#
# GoodMorningPlanet.com
# author : Vincent Loy <vincent.loy@activkonnect.com>
# (c) 2015 ActivKonnect
"""
Repair bad formatted Markdown Files - replace **foo** by #foo
only when a line start and end by strong tag
"""
You can’t perform that action at this time.