Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️

Pierre Bertet bpierre

✌️
View GitHub Profile
@raphaelbastide
raphaelbastide / correction.md
Last active Aug 29, 2015
Brackets notation
View correction.md

Plain text notation for correction and review

This document has now its own repository.

How to use brackets [ ] to advise lossless corrections.

In short

[1][2][3]
View bash_colours.sh
## Colours and font styles
## Syntax: echo -e "${FOREGROUND_COLOUR}${BACKGROUND_COLOUR}${STYLE}Hello world!${RESET_ALL}"
# Escape sequence and resets
ESC_SEQ="\x1b["
RESET_ALL="${ESC_SEQ}0m"
RESET_BOLD="${ESC_SEQ}21m"
RESET_UL="${ESC_SEQ}24m"
# Foreground colours
@domenic
domenic / .bashrc
Last active Sep 1, 2015
.bashrc with GitHub PR function
View .bashrc
pr () {
git fetch origin refs/pull/$1/head:refs/remotes/origin/pr/$1 --force
git checkout -b pr/$1 origin/pr/$1
git rebase master
git checkout master
git merge pr/$1 --ff-only
}
@mrdoob
mrdoob / gist:845802
Created Feb 27, 2011
video to looped animated gif
View gist:845802
ffmpeg -i out.ogv -s 160x128 -pix_fmt rgb24 -ss 62.6 -t 3 -r 5 -loop 0 -f gif out.gif
convert -loop 0 -layers Optimize out.gif outopt.gif
View raphael.default.js
var ctx = modul.context;
function skin_Default() {
ctx.clearRect(0,0,50,50);
// modul.io DEFAULT SKIN
ctx.beginPath();
// Here is a trick to random the modul's color:
ctx.fillStyle="rgba(" + Math.floor( Math.random() * 255) + "," + Math.floor( Math.random() * 255) + "," + Math.floor( Math.random() * 255) + ",1)";
//eyes
ctx.fillRect(12,3, 4, 4);
@substack
substack / switch.js
Created Oct 4, 2011
regex fall-throughs using a switch(true), inspired by @AvianFlu
View switch.js
substack : ~ $ node switch.js bleep blah
blah
substack : ~ $ node switch.js for the lose
lose
substack : ~ $ node switch.js for the win
win
substack : ~ $ node switch.js for the fail
fail
substack : ~ $
@getify
getify / ex1.php
Created Aug 12, 2012
exploring inline decision-logic in templates
View ex1.php
<!-- here's the PHP'ish way of making inline decisions while constructing HTML markup -->
<select name="foobar">
<option value="bam" <?=($foobar==="bam"?"selected":"")?>>Bam</option>
<option value="baz" <?=($foobar==="baz"?"selected":"")?>>Baz</option>
</select>
<input type="radio" name="foobar" value="bam" <?=($foobar==="bam"?"checked":"")?>> Bam
<input type="radio" name="foobar" value="baz" <?=($foobar==="baz"?"checked":"")?>> Baz
@cjanis
cjanis / gist:3908053
Created Oct 17, 2012 — forked from kylebarrow/example.html
Prevent internal links in iOS standalone web apps from opening in Mobile Safari
View gist:3908053
if (window.navigator.standalone) {
var local = document.domain;
$('a').click(function() {
var a = $(this).attr('href');
if ( a.match('http://' + local) || a.match('http://www.' + local) ){
event.preventDefault();
document.location.href = a;
}
});
}
@padolsey
padolsey / 1.js
Created Feb 21, 2013
A little JS [ES3] task: In each case, implement `x` so that the expression is true. Do not modify the expressions though. Post your solutions as a fork of this gist. ***Remember: ES3 only.
@maxogden
maxogden / readme.md
Last active Dec 14, 2015
js 'pagelet' concept
View readme.md

pagelet

tries to provide a way to use NPM to distribute web components with as little abstraction as possible

  • uses plain index.js, style.css, index.html etc
  • works in multiple environments

example (intentionally verbose)

consider a module called 'simple-button':