Skip to content

Instantly share code, notes, and snippets.

View Canop's full-sized avatar
🦀
You want to contact me? Come to miaou (https://miaou.dystroy.org) and ask for me

Denys Séguret Canop

🦀
You want to contact me? Come to miaou (https://miaou.dystroy.org) and ask for me
View GitHub Profile
@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

(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

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:

I am the Miaou user with id 4 and name "dys" on http://127.0.0.1:8204
I am the Miaou user with id 1 and name "dystroy" on http://dystroy.org/miaou
@Canop
Canop / PTSet.java
Last active August 29, 2015 14:16
CSV Parsing
package com.keods.gamaster;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
{"type":"Tribo","status":"finished","players":[{"name":"meow","id":449},{"id":838,"name":"Cebolla"}],"scores":[52,48],"moves":"U¯V°WM®§aN¨OE¦\u009FYT\u009ES\u009D­R¬Q«\\ªf_´`jik[¾É]gpÓyÞqßr|êh}ë~\u0088éèxç\u0082Òd"}
{"type":"Tribo","status":"finished","players":[{"name":"CS-","id":1226},{"id":819,"name":"Retsam"}],"scores":[46,54],"moves":"TÂUÃS]ÄËIhºK°¥J@6ÀRµH«>?=¿¾¦<§\u009CrÊ|qÔÉÞ{Ï\u0085}sijaè7\u00925-Ùtã±~\u0088²»¼ÆílävåÇwªm"}
{"type":"Tribo","status":"finished","players":[{"name":"Retsam","id":819},{"id":1226,"name":"CS-"}],"scores":[56,44],"moves":"UÂ_ÍKTÌjËÖ×V`atáÕßâ\x7FìuÁ\u0089IÀµR¿JH«¢@6¡5£\u0098*\u0097+\u008DS"}
{"type":"Tribo","status":"finished","players":[{"name":"CS-","id":1226},{"id":687,"name":"Unihedron"}],"scores":[47,53],"moves":"T¹_º^»®`hS¯RI°¥¦¤\u009AÅ?kÎiØsg}âë|\u0099\u0086\u0098¢H¡\\GF ÆvÇìlíÑ\u0080uÛã\u008B\u008Eå\u008A"}
{"type":"Tribo","status":"finished","players":[{"name":"Unihedron","id":687},{"id":1226,"name":"CS-"}],"scores":[63,37],"moves":"T¹^ÃJi¯ÌjËkaÊÀWI¶°Hs±Ö}|º{X¦¥Y?
import world from './world.js';
class Query {
// Generic Stuff
constructor(){
this._path = 'rest';
this._body = null;
}
@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]"
);
});
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.