Skip to content

Instantly share code, notes, and snippets.

View coclav's full-sized avatar

Colin Claverie coclav

View GitHub Profile
@coclav
coclav / sortSemVer.php
Last active September 21, 2022 07:51
PHP Laravel sort by semver, software version or version-dotted number
<?php
use Illuminate\Support\Collection;
function sortSemVer(Collection $data)
{
$mapped = $data->map(function ($a, $i) {
return [
'index' => $i,
'value' => str_split($a),
{
"columns": [
{
"title": "Your Name",
"key": "name"
},
{
"title": "Your Surname",
"key": "surname"
},
as of 20th May 2020, from here : https://europa.eu/youreurope/business/taxation/vat/vat-rules-rates/index_en.htm
curl https://api.stripe.com/v1/tax_rates -u sk_live_XXXXX: -d display_name=VAT -d description="VAT AT" -d jurisdiction=AT -d percentage=20 -d inclusive=false
curl https://api.stripe.com/v1/tax_rates -u sk_live_XXXXX: -d display_name=VAT -d description="VAT BE" -d jurisdiction=BE -d percentage=21 -d inclusive=false
curl https://api.stripe.com/v1/tax_rates -u sk_live_XXXXX: -d display_name=VAT -d description="VAT BG" -d jurisdiction=BG -d percentage=20 -d inclusive=false
curl https://api.stripe.com/v1/tax_rates -u sk_live_XXXXX: -d display_name=VAT -d description="VAT CY" -d jurisdiction=CY -d percentage=19 -d inclusive=false
curl https://api.stripe.com/v1/tax_rates -u sk_live_XXXXX: -d display_name=VAT -d description="VAT CZ" -d jurisdiction=CZ -d percentage=21 -d inclusive=false
curl https://api.stripe.com/v1/tax_rates -u sk_live_XXXXX: -d display_name=VAT -d description="VAT DE" -d jurisdiction=
@coclav
coclav / getResponse.php
Last active November 5, 2019 21:50
Skore test block
<?php
/**
* works with laravel route()
* if you want to force a HTTP verb, append it to the route e.g. v1.processes.update.post to force using post instead of the default patch on update
*/
public function getResponse($endpoint, $queryParams = [], $bodyParams = [])
{
// first -- get the right method
<mxGraphModel dx="797" dy="506" grid="0" gridSize="10" guides="1" tooltips="0" connect="1" arrows="0" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="826" template="1" background="#ffffff">
<root>
<mxCell id="0">
<stylesheets as="stylesheets">
<stylesheet value="default">
<style value="whatbox" styleTokens="fontColor=SeaGreen;rounded=1;"/>
<style value="whybox" styleTokens="strokeColor=transparent;"/>
<style value="stickynote" styleTokens="fontColor=SeaGreen;"/>
</stylesheet>
</stylesheets>
<mxGraphModel dx="3454" dy="575" grid="1" gridSize="10" guides="1" tooltips="0" connect="1" arrows="0" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="826" background="#ffffff" skoreFileSpec="2">
<root>
<mxCell id="0">
<roles as="roles">
<role value="פרוייקטור"/>
<role value="בעלי דירות"/>
<role value="כלכלן"/>
<role value="מנכ&quot;ל"/>
<role value="מהנדס"/>
<role value="מתכנן ראשי"/>
@coclav
coclav / copyContent
Last active March 18, 2024 11:58
Copy file out of ASAR archive for Electron app
var fs = require("fs");
var app = require("remote").require("app");
var fsj = require("fs-jetpack");
// example usage : copyFileOutsideOfElectronAsar( "myFolderInsideTheAsarFile", app.getPath("temp") + "com.bla.bla"
var copyFileOutsideOfElectronAsar = function(sourceInAsarArchive, destOutsideAsarArchive) {
if ( fs.existsSync( app.getAppPath() + "/" + sourceInAsarArchive ) ) {
// function that will tell the browser if you can "select" the field or not ... returns false most of the time
skShell.textEditing = mxUtils.bind(this, function (evt) { // this binds this to the current element... not sure you actually need that
evt = evt || window.event;
// tells if the evt target has the class "selectionAllowed"
if (this.isSelectionAllowed(evt)) {
return true; // normal behaviour (selection, context menu...)
@coclav
coclav / cheers.css
Last active November 17, 2022 12:20
Animated congratulation message that evaporates, game style
.animated{
-webkit-animation-fill-mode:both;
-moz-animation-fill-mode:both;
-ms-animation-fill-mode:both;
-o-animation-fill-mode:both;
animation-fill-mode:both;
-webkit-animation-duration:1.5s;
-moz-animation-duration:1.5s;
-ms-animation-duration:1.5s;
-o-animation-duration:1.5s;
@coclav
coclav / gist:5760690
Last active March 11, 2019 18:43
Start the animation of a .gif on click. This adds a "start / stop" button below your still image (abc_still.gif / class : img_anim) that will change the .gif to the animated version (abc.gif)
jQuery(".img_anim").after( function() {
// keep ref to the image
var image = this;
// add div container for the link
var $d = jQuery("<div />");
// add link
var $a = jQuery("<a>Start / Stop animation</a>");