Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am simounet on github.
  • I am simounet (https://keybase.io/simounet) on keybase.
  • I have a public key ASBg4vFTFqYeFB-z59vEWXqnuBaLwiP3EjttnGV8RxcR2Qo

To claim this, I am signing this object:

@Simounet
Simounet / relative-font-size.scss
Created August 13, 2015 12:09
Relative font size Compass mixin
@mixin relative-font-size( $px-size, $unit: 'rem', $context: $base-font-size ) {
@if $px-size == 0 {
@error "$px-size value can't be equalse to 0.";
}
@if unit( $px-size ) != "px" {
@error "$px-size must be value in pixels."
}
@if $unit != 'rem'
@Simounet
Simounet / gulpfile.js
Last active March 30, 2018 11:33
Looking for the best way to repeat task in Gulp
var destination = imagesBase + '1x/';
var destinationRetina = imagesBase + '2x/';
gulp.task("default", function() {
spriteAndCompress( destination );
spriteAndCompress( destinationRetina, 'retina' );
});
@Simounet
Simounet / sprite-before-generator
Created May 22, 2014 10:08
Compass sprite generator with before pseudo class
$files: sprite-map("file/*.png");
%file-sprite {
display: inline-block;
margin-right: 8px;
@include sprite-dimensions($files, 'doc');
background: sprite-url($files) no-repeat;
content: '';
vertical-align: middle;
}
@Simounet
Simounet / local_or_global.sh
Created February 17, 2014 14:28
Bash script to check if there is a local command's version before the global one
#!/bin/bash
alias be='local_or_global behat'
alias comp='local_or_global composer /usr/local/bin/'
function local_or_global() {
if [ -f ./bin/$1 ]
then
echo "LOCAL:"
./bin/$1
elif [ $2 ] && [ -f $2$1 ]
then
@Simounet
Simounet / getArrayTags.php
Created January 29, 2014 13:08
Get tags from a mixed string with or without quotes (grouped or not)
<?php
function getTags($tag_list) {
$matches = array();
// Get the words grouped between quotes (ex: "Manu Chao")
preg_match_all('~(["\'])([^"\']+)\1~', $tag_list, $quoted);
// Get the others
$unescaped = trim(str_replace($quoted[0], "", $tag_list));
@Simounet
Simounet / .gitattributes
Created January 17, 2014 13:11
Git's filter tabs to spaces
*.php filter=tabspace4
*.tpl filter=tabspace4
*.xml filter=tabspace4
*.yml filter=tabspace2
@Simounet
Simounet / snippets.tpl
Last active December 28, 2015 18:49
Snippets for eZ Publish
{* Button to create a new content *}
<form action="/content/action" method="post">
{* set the class identifier to use *}
<input type="hidden" name="ClassIdentifier" value="article">
{* set the language to use *}
<input type="hidden" name="ContentLanguageCode" value="fre-FR">
{* set the parent node id to use *}
<input type="hidden" name="NodeID" value="{$module_result.node_id}">
<input class="button" type="submit" value="Create a new content under this one" name="NewButton">
</form>
@Simounet
Simounet / .bashrc
Created December 3, 2012 22:48
SVN aliases
alias sadd="svn status |grep '\?' |awk '{print $2}'| xargs svn add"
alias grepf="grep --exclude=*.svn-base --exclude-dir=\.svn --exclude=*~ "
svndiff()
{
svn diff "${@}" | colordiff
}
@Simounet
Simounet / gist:3911421
Created October 18, 2012 12:13
JS Print_r
function print_r(obj) {
win_print_r = window.open('about:blank', 'win_print_r');
win_print_r.document.write('<html><body>');
r_print_r(obj, win_print_r);
win_print_r.document.write('</body></html>');
}
function r_print_r(theObj, win_print_r) {
if(theObj.constructor == Array || theObj.constructor == Object){
if (win_print_r == null)