Skip to content

Instantly share code, notes, and snippets.

Jonathan Lafleur jonathanlaf

Block or report user

Report or block jonathanlaf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonathanlaf
jonathanlaf / HowToSlackDark.md
Last active May 10, 2019
[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.