Skip to content

Instantly share code, notes, and snippets.

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

Vincent Loy VincentLoy

🏠
Working from home
View GitHub Profile
@VincentLoy
VincentLoy / bitcolor.js
Last active August 29, 2015 14:14 — forked from lrvick/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 August 29, 2015 14:16
Foundation 5 Sliding pagination control implementation for KnpPaginationBundle for Symfony 2
{#
/**
* @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
/**
* 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 April 4, 2015 12:32
less / css - snippets
// ===========================================
// 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);
}
@VincentLoy
VincentLoy / mailchimp.snippet.php
Created April 8, 2015 21:53
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 August 29, 2015 14:18 — forked from planetoftheweb/tweets_json.php
easly display tweet
##
## 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
##
@VincentLoy
VincentLoy / metutils.py
Created May 12, 2015 16:42
some weather utilities functions
#!/usr/bin/env python
"""
Tropical Cyclone Risk Model (TCRM) - Version 1.0 (beta release)
Copyright (C) 2011 Geoscience Australia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
# 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
@VincentLoy
VincentLoy / scrollTo.js
Created June 5, 2015 16:44
scrollTo jQuery
$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 June 25, 2015 19:16
Test with the Monty Hall problem
# 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):