Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working

Jonathan Lafleur jonathanlaf

:octocat:
Working
View GitHub Profile
@jonathanlaf
jonathanlaf / index.js
Last active Oct 26, 2020
Get element parent or sibling by id / class name or tag name
View index.js
/*
* Use case:
* Need to toggle the next row
*
* The first part of this script is for demo purpose. (In order to make the demo work, you need bootstrap.)
*/
// Get all the btns
const informationToggleBtns = document.querySelectorAll('.toggle-info');
@jonathanlaf
jonathanlaf / fix_permission.sh
Last active Apr 14, 2020
Fix Wordpress Permission
View fix_permission.sh
#!/bin/bash
#
# To download from command line :
# wget https://gist.githubusercontent.com/jonathanlaf/0240b8c401651af742ac826a69125440/raw/822eafea11056f55f5a239f8fa7062a43a05d600/fix_permission.sh
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
@jonathanlaf
jonathanlaf / articulate-storyline3-howto.md
Last active Aug 27, 2019
How to disable Next buttons while timeline play. Articulate Storyline 3
View articulate-storyline3-howto.md

How to disable Next button while timeline play. Articulate Storyline 3

Here's my setup to disable Next button while the virtual teacher talk.

Set a global variable

  • In the top right corner of your Triggers panel click on the variable button "Variable button"
  • Add a new variable
    • Name: slidePlaying
    • Type: True/False
@jonathanlaf
jonathanlaf / articulate-free-menu-to-locked.md
Last active Jun 20, 2019
How to control menu type in Articulate Storyline 3 (with javascript)
View articulate-free-menu-to-locked.md

How to control menu type in Articulate Storyline 3 (with javascript)

Lock the menu untill you reach a certain slide

  • On the starting slide:
    • Set the variable introPlayed with a default of false on the starting slide.
    • Add a trigger with the following settings:
      • Action: Execute JavaScript
      • Script: see "Lock the menu"
      • When: Timeline starts
      • Object: make sure your starting slide is selected
@jonathanlaf
jonathanlaf / HowToSlackDark.md
Last active Jan 12, 2020
[Dark Slack] How to hack Slack to get a dark theme #slack #css #hack
View HowToSlackDark.md

🔥 How to "Hack" Slack to get a dark theme. 🔥

Slack Dark Theme

Close Slack if it's running

Installing theme

In your favorite text editor, open the following file :

  • Windows C:\Users\<USERNAME>\AppData\Local\slack\app-<VERSION>\resources\app.asar.unpacked\src\static\ssb-interop.js
@jonathanlaf
jonathanlaf / benchmark-for-vs-foreach.php
Last active Sep 26, 2018
[Benchmark Loops] Benchmark of FOR vs FOREACH loop functions in php #php #benchmark
View benchmark-for-vs-foreach.php
<?php
$a = array();
for ($i = 0; $i < 100000; $i++) {
$a[] = $i;
}
$start = microtime(true);
foreach ($a as $k => $v) {
$a[$k] = $v + 1;
}
@jonathanlaf
jonathanlaf / convertSameCaracterToSameAscii.php
Last active Aug 14, 2018
[Keyboard char to Ascii] Take care of different ASCII Code returned by a single caracter depending on Keyboard layout. #encoding #php #ascii
View convertSameCaracterToSameAscii.php
<?php
/*
* Accept array or string
*/
function convertSameCaracterToSameAscii($string)
{
$tab_chr = array() ;
for($control = 0; $control < 32; $control++) {
if ($control != 9 && $control != 10) {
$tab_chr[]= chr($control) ;
@jonathanlaf
jonathanlaf / getClosestLowerValue.php
Last active Aug 14, 2018
[Closest value operator] Get closest value (of an array) before a given one #php #operand
View getClosestLowerValue.php
<?php
function valueExpected ($analyse, $expect, $strict = false)
{
if ($strict)
{
if ($analyse === $expect)
{
return '<span style="background-color:darkolivegreen; color:darkgrey;">Received : ' .
$analyse .
', Expected : ' .
@jonathanlaf
jonathanlaf / wpex_pagination.php
Last active Aug 14, 2018
[wpexplorer's WordPress pagination script enhanced.] #wordpress
View wpex_pagination.php
/*
* Numbered Pagination
* http://www.wpexplorer.com/pagination-wordpress-theme/
*/
if ( !function_exists( 'wpex_pagination' ) ) {
function wpex_pagination($wpex_query) {
$prev_arrow = is_rtl() ? '&rarr;' : '&larr;';
$next_arrow = is_rtl() ? '&larr;' : '&rarr;';
/*
You can’t perform that action at this time.