Skip to content

Instantly share code, notes, and snippets.

View Canop's full-sized avatar
🦀
Available for missions (design, code, formation,etc.)

Denys Séguret Canop

🦀
Available for missions (design, code, formation,etc.)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am canop on github.
  • I am dystroy (https://keybase.io/dystroy) on keybase.
  • I have a public key whose fingerprint is 2015 FB66 CB39 EA9E 0D1E 2C04 ECDB 239B 9417 F31A

To claim this, I am signing this object:

(function() {
// setting it up so you can view it
document.documentElement.style.height = '100%';
left.style.background = 'Transparent';
right.style.background = 'Transparent';
document.body.style.background = 'linear-gradient(to bottom, #F5F5F5 0%,#1E90FF 100%)';
}())
Math.Tau = Math.PI * 2;
// utils
@Canop
Canop / gist:0b931ca60cbb0afc09cd
Last active August 29, 2015 14:01
Proposal for some sugar for default values in JavaScript

To deal with default argument value, we often use :

a = a || defaultValue;

or when a falsy value can be a valid argument :

if (a===undefined) a = defaultValue;

I think we could have some helpful sugar here, by which the last LOC would be written

@Canop
Canop / gist:6521072
Last active December 22, 2015 19:39
$(function(){
$('<a class="sceditor-button" unselectable="on" title="id monstre"><div unselectable="on" style="background-image:url(https://mehcig.bn1.livefilestore.com/y2pFL7YDttfhV4S1OWqwvMlXZGcHIEs4KlyS8Rywhft7EJYfi-7DW5o8eKlFz3VOFd_Itm8Y_JVrdMqXhzjCc5peMAWEKoKb-jIGXZhJ7XH1-w/IDM.png?psid=1)">Bouton Id Monstre</div></a>').insertAfter('.sceditor-button-quote').click(function(){
var editor = $('#text_editor_textarea').sceditor("instance");
var truc = editor.getSelection();
editor.insertText(
"[url=http://games.mountyhall.com/mountyhall/View/MonsterView.php?ai_IDPJ=" + truc + "]" + truc + "[/url]"
);
});
});