Skip to content

Instantly share code, notes, and snippets.

jeremypetrequin / migrate-db.php
Last active Dec 1, 2020
Task NPM//PHP to generate SQL queries to migrate a WP
View migrate-db.php
if(empty($_SERVER['npm_config_to'])) {
die('Missing --to parameter'.PHP_EOL);
$to = $_SERVER['npm_config_to'];
$_SERVER['SERVER_NAME'] = $_SERVER['npm_package_url'];
define('WP_USE_THEMES', false);
jeremypetrequin / gutenberg.js
Created Apr 17, 2020
To be abble to transform gutenberg core block into ACF custom block
View gutenberg.js
window.F = window.F || {}; //your custom namespace
//prepare yours transformers
window.F.blocks = {
transformParagraphToQuestion(attributes) { //the transform name you write un your PHP
//very ugly, maybe ask to ACF is there is a better option?
let interval = setInterval(() => { //we wait for the ACF block fields to be ready in the DOM
//your ACF field key in the block
//mine is a wysiwyg field, so I look for an iframe, but else you can simply look for the input you want
let $iframe = document.querySelector('[data-key="field_5e579284bf0a2"] iframe');
let iframeDoc = null;
jeremypetrequin / footer.php
Created Jan 10, 2018
Track SQL numbers in wordpress
View footer.php
jeremypetrequin / script
Created May 26, 2014
Find what f***** DOM element break your responsive by adding a horz scrollbar
View script
//put this in your console, and see the red elements
var breakpoint = 320;
$('*').each(function() {
($t = $(this)).outerWidth() + $t.offset().left > breakpoint && console.log($t.css('background', 'red'));
jeremypetrequin /
Last active Dec 25, 2016
How to convert a Flash/After Effects animation into a JSMovieclip animation

How to convert a Flash/After Effects animation into a JSMovieclip animation


JSMovieclip is a little javascript framework. It allows you to play, control... animations like a Movieclip object in AS3. It uses a sprite which contains all frames of the animation.

Purpose : We'll create a sprite to use with JSMovieclip, from a Flash animation, using TexturePacker

Requirement : We'll use Flash/After Effects, Texture Packer, and JSMovieclip script

View robot.js
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;