Skip to content

Instantly share code, notes, and snippets.

View dievardump's full-sized avatar

Simon Fremaux dievardump

View GitHub Profile
UNKNOWN = "*"
BOMB = "B"
GRID_SIZE = 5
def init1():
return [[UNKNOWN] * GRID_SIZE] * GRID_SIZE
def init2():
grid = []
for i in range(GRID_SIZE):
@dievardump
dievardump / promise.js
Last active August 29, 2015 14:15
Really simple implementation of Promise - Not fully tested (catch was not)
var Promise = function(resolver) {
if (typeof resolver !== 'function') {
throw new Error('Promise constructor parameter must be a function.');
}
this._callbacks = [];
this._catchers = [];
this.running = true;
@dievardump
dievardump / avatar yahouuuu
Created July 26, 2012 21:12
avatar yahouuuu
$('body').append('<style>@-moz-keyframes myEffingAnimation { 25% { -moz-transform: rotate(-360deg) scale(4); } 50% { -moz-transform: rotate(0) scale(1); } 75% { -moz-transform: rotate(360deg) scale(4); } 100% { -moz-transform: rotate(0) scale(1); }}@-webkit-keyframes myEffingAnimation { 25% { -webkit-transform: rotate(-360deg) scale(4); } 50% { -webkit-transform: rotate(0) scale(1); } 75% { -webkit-transform: rotate(360deg) scale(4); } 100% { -webkit-transform: rotate(0) scale(1); }}@-ms-keyframes myEffingAnimation { 25% { -ms-transform: rotate(-360deg) scale(4); } 50% { -ms-transform: rotate(0) scale(1); } 75% { -ms-transform: rotate(360deg) scale(4); } 100% { -ms-transform: rotate(0) scale(1); }}@-o-keyframes myEffingAnimation { 25% { -o-transform: rotate(-360deg) scale(4); } 50% { -o-transform: rotate(0) scale(1); } 75% { -o-transform: rotate(360deg) scale(4); } 100% { -o-transform: rotate(0) scale(1); }}@keyframes myEffingAnimation { 25% { transform: rotate(-360deg) scale(4); } 50% { transform:
@dievardump
dievardump / simily-zenco-js
Created August 16, 2012 15:17
simily Zencoding Template Engine
var template = '(div[id=menu, class={menu.menuclass}]>ul>li[class={menu.itemclass}, html={title}, map={menu.items}])+(div[class=body]>div[class=content]>p[html={maincontent}])',
data = {
maincontent: 'foo bar',
menu: {
menuclass: 'menu',
itemclass: 'menu-item',
items: [
{ title: 'first entry' },
{ title: 'second entry' },
{ title: 'third entry' },
@dievardump
dievardump / gist:3981866
Created October 30, 2012 17:56 — forked from AmaanC/gist:1472190
u mad bro?
/*
█░░░░░█░░░░░░░░░░░░░░░░░░░░░█░░█░░░░░░░░░░░░░░█▀▀█
█░█▀█░█░░█░█░░█▀█▀█░█▀▀█░█▀▀█░░█▀▀█░█▀▀░█▀▀▀█░░░░█
█░█░█░█░░█░█░░█░█░█░█▀▀█░█░░█░░█░░█░█░░░█░░░█░░▀▀▀
▀░▀▀▀░▀░░▀▀▀░░▀░░░▀░▀░░▀░▀▀▀▀░░▀▀▀▀░▀░░░▀▀▀▀▀░░█░░
*/
@dievardump
dievardump / gist:6042052
Created July 19, 2013 20:18
gmap SO user
if (navigator.geolocation) {
function allowed(position) {
initialise(true, position);
}
function refused() {
initialise(false);
}
@dievardump
dievardump / scss-variables.md
Last active December 20, 2015 03:19
http://emwaw.me/ variables methodology

Hi guys !

So I read your concept, and completely agree with the first point: $background-color: #fff; is not possible for long term. However, I see in your approach some flaws concerning DRY and reusable elements/modules like the ones we can see in OOCSS and similar libraries.

So I will point out what I think can be flaws, and my solutions, and would love your feedback on that: Context:

My page contains several blocks which all have the same background-color.
My page will evolved with time.

04ee539b4c9f3a52bde8849b6120811507402306cbd3f120bcab20fbfdba6e5ffa7704d6e808a23e0740ce7676e2dbc661473767610a27be3259f1b7362b1d01bf;romanornr
@dievardump
dievardump / animate.js
Created December 20, 2019 14:44
Very simple animation class vanilla js
/**
Usage
const animate = new Animate((value, elapsed) => {
console.log(value, elapsed);
}, {
duration: 5000
});
animate.animate(0, 100);
@dievardump
dievardump / fetcher.js
Last active February 26, 2020 16:05
Fetch wrapper
/**
Usage
To set default values, used for every request :
fetcher.setMode('include');
fetcher.setHeader('include');
// to make a request
fetcher() // builds a fetcher instance
.get(url, options) //