Skip to content

Instantly share code, notes, and snippets.

View charleslouis's full-sized avatar

okcharlo charleslouis

View GitHub Profile
@charleslouis
charleslouis / bem-cheat-sheet.txt
Created June 5, 2013 11:24
CSS - BEM - Cheat Sheet
For more details, see :
SMACCS and Fifty Shades of BEM (http://blog.kaelig.fr/post/48196348743/fifty-shades-of-bem)
prefix-ComponentName
prefix-ComponentName-MODIFIERNAME
prefix-ComponentName-subObject
prefix-ComponentName-subObject-MODIFIERNAME
p- Page specific (class applied on the body element), very useful for static pages where maintainability is not at stake — should be avoided in the application itself (e.g.: p-Homepage).
@charleslouis
charleslouis / RandomClassesDivs.js
Created April 18, 2013 23:31
Javascript - append div in a container with random classes and positions
(function RandomClassesDivs(){
// declare classes we want to apply
var bubbleColors = ['bubble_color_1', 'bubble_color_2', 'bubble_color_3', 'bubble_color_4', 'bubble_color_5', 'bubble_color_6'];
var bubbleSizes = ['bubble_1', 'bubble_2', 'bubble_3', 'bubble_4', 'bubble_5'];
//find the highest key of the classes arrays
var nbrSizes = (bubbleSizes.length) - 1,
nbrColors = (bubbleColors.length) - 1;
@charleslouis
charleslouis / sudo dpkg-reconfigure resolvconf
Created October 20, 2016 08:12
sudo dpkg-reconfigure resolvconf
sudo dpkg-reconfigure resolvconf
@charleslouis
charleslouis / valueToPlaceholder.js
Last active July 27, 2016 07:18
#value #placeholder #attribute #html5 #form #input #inputfiled #jquery
function valueToPlaceHolder(divId){
// this function creates a placeholder based on the attribute 'value' of this same input text field
//once done, it removes the 'value' attribute
// it is useful for cforms II plugin cos placholder are not available, while default value attr are
// THIS :
// <input xxx value="Prénom - First name" xxx>
// would return :
// <input xxx placeholder="Prénom - First name" xxx>
// see http://stackoverflow.com/questions/11432144/change-value-to-placeholder-input-field
if( document.getElementById(divId) ){
@charleslouis
charleslouis / keystone-Page.js
Created December 1, 2015 15:22
keystone-Page.js model page model
var keystone = require('keystone');
var Types = keystone.Field.Types;
/**
* Page Model
* ==========
*/
var Page = new keystone.List('Page', {
map: { name: 'title' },
@charleslouis
charleslouis / fullpath.php
Created January 11, 2014 15:13
fullpath.php is a small PHP script that prints the full path to the directory it is placed in. Copy the code and paste it into a file called fullpath.php. You can then upload the file to the directory where you want to place the .htpasswd. Then point your browser to http://www.your-domain.com/path/to/fullpath.php Credits and more info here : htt…
<?php
$dir = dirname(__FILE__);
echo "<p>Full path to this dir: " . $dir . "</p>";
echo "<p>Full path to a .htpasswd file in this dir: " . $dir . "/.htpasswd" . "</p>";
?>
@charleslouis
charleslouis / phpMyAdmin-drupal-binary-blob.php
Created January 8, 2014 10:11
Configuring phpmyadmin to show Drupal 7 BLOB data #drupal, #phpmyadmin,#php, #mysql, #BLOB, #binary
<?php
# Show 1000 rows instead of 30 by default
$cfg['MaxRows'] = 1000;
# Show BLOB data as a string not hex.
$cfg['DisplayBinaryAsHex'] = false;
# Show BLOB data in row detail pages.
$cfg['ProtectBinary'] = false;
# Show BLOB data on table browse pages. Hack to hardcode all requests.
$_REQUEST['display_blob'] = true;
?>
@charleslouis
charleslouis / worksheetName.xlfunction
Created December 4, 2013 09:40
#worksheet #workbook #formula formula to find worksheet name in a cell Excel - Excel Formulas
=DROITE(CELLULE("nomfichier");NBCAR(CELLULE("nomfichier"))-TROUVE("]";CELLULE("nomfichier")))
B24 =CELLULE("nomfichier";A1) => F:\Dropbox\folder\folder\folder\[workbook.xlsx]worksheet
B25 =TROUVE("]";$B$24) => 47
B26 =NBCAR(B24) =>56
B27 =B26-B25 => 9
B28 =DROITE($B$24;$B$27) => worksheet
@charleslouis
charleslouis / activeAnchor.js
Created November 29, 2013 08:53
#activeAnchor, #active, #anchor, #css, #javascript
/**
* Adds a class togClass (ex:'active') to anchor links within a page that are within an element with and id of id
* @param {id} id(without #) The id of the div in wich the anchors are embeded
* @param {togClass} class (without .) The class we want to toggle
* @return {nothing}
*/
function activeAnchor(id, togClass){
$('#' + id + ' a[href^="' + location.hash + '"]').addClass(togClass);
$(window).bind('hashchange', function() {
@charleslouis
charleslouis / Gruntfile.basement.js
Created November 15, 2013 09:43
#grunt #gruntfile #basement #watch #sass #jshint #uglify
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [