Skip to content

Instantly share code, notes, and snippets.

View Purexo's full-sized avatar
🦄
I may be slow to respond.

Purexo Purexo

🦄
I may be slow to respond.
View GitHub Profile
@Purexo
Purexo / to_pocketbook.sh
Last active April 8, 2019 07:55
a bash script (need imagemagick >6.8.3-10, zip, unzip, unrar) who will convert pictures for pocketbook with an inteligent minimal weight
#!/usr/bin/env bash
# a bash script (need imagemagick >6.8.3-10, zip, unzip, unrar) who will convert pictures for pocketbook with an inteligent minimal weight
# create UNARCHIVED folder
# create TRANSFORMED folder
# create OUTPUT folder
#
# for archive file
# unarchive in new folder in UNARCHIVED with name file - ext
@Purexo
Purexo / printRS.java
Last active April 20, 2018 09:50
java printResultSet
private void printRS(ResultSet rs) throws SQLException {
List<String> header = new ArrayList<>();
Map<Integer, Integer> max = new HashMap<>();
// generate header map
ResultSetMetaData meta = rs.getMetaData();
for (int i = 1; i <= meta.getColumnCount(); i++) {
String collumn = meta.getColumnName(i);
// compute max column width
@Purexo
Purexo / RolledList.php
Created March 8, 2017 15:30
Une liste avec une taille limite et des items qui sortent au fur et à mesure.
<?php
/**
* Created by PhpStorm.
* User: Purexo
* Date: 08/03/17
* Time: 10:45
*/
namespace VillageBundle\Utils;
const handlerStorage = {
get(target, key) {
const value = target.getItem(key);
try {
return JSON.parse(value);
} catch (e) {
return value;
}
},
@Purexo
Purexo / svgtopng.sh
Last active November 8, 2016 15:59
a little bash script (need inkscape installed) for transform svg in png
#!/bin/bash
# Default Parameters
pattern="*.svg"
output="./svgtopng-output"
x=false
width="128"
y=false
height="128"
@Purexo
Purexo / CandyBox-AutoSave-AutoQuest-UserScript.js
Last active October 21, 2016 14:44
UserScript for Candy Box 1. AutoSave and AutoQuest ^^
// ==UserScript==
// @name CandiBox 1 - AutoSave
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Purexo
// @require https://gist.githubusercontent.com/purexo/0d27aad481158047ae852dc10d779cd9/raw/bc931c67e74d5d9d9d205ea456bc52d64f94e124/SimpleEventManager.js
// @include http://candies.aniwey.net/*
// @grant none
// ==/UserScript==
@Purexo
Purexo / SimpleEventManager.js
Last active October 21, 2016 12:17
A simple event manager JS (browser) with an simple API like socket.io : on and emit function
'use strict';
/**
* SimpleEventManager is a simple API for create and listen Event
* It's a superset of DOM Event listening API
*
* Example :
let event = new SimpleEventManager(function(lastState) {
// watched variable
@Purexo
Purexo / ModuleParticule
Created February 12, 2016 10:09
Superpowers-script-ModuleParticule
module Particule {
class Color extends Sup.Color {
static random () {
let Random = Sup.Math.Random;
return new Color(
Random.integer(0, 100) / 100,
Random.integer(0, 100) / 100,
Random.integer(0, 100) / 100
);
}
@Purexo
Purexo / SoundController.ts
Created December 11, 2015 13:52
Superpowers Abstraction Sound
namespace Sound {
export interface contructorSoundController {
MUSIC_PATH: string;
SOUND_PATH: string;
// musics['category']['nom'] = 'relative/path/from/MUSIC_PATH'
// tableau associatif de tableau associatif
musics: {
[index: string]: {
[index: string] : string
@Purexo
Purexo / localStorage.js
Created December 2, 2015 17:58
Binding localStorage API to extend the key -> value functionnality with JSON api
/**
* @author : Purexo
* @description : Binding localStorage API to extend the key -> value functionnality with JSON api
* when setItem, data is stringify
* when getItem, data is parsed
* @usage :
* ls.setItem('key', data)
* ls.getItem('key', data)
* ls.removeItem('key')
* ls.key('index')