Skip to content

Instantly share code, notes, and snippets.

View bricejulia's full-sized avatar

Brice Julia bricejulia

View GitHub Profile
@bricejulia
bricejulia / functions.inc.php
Created June 12, 2023 16:13
batch function
<?php
function batch(
iterable $items,
callable $exec,
?callable $flush = null,
int $batchSize = 20,
): void
{
$current = 0;
@bricejulia
bricejulia / getDelayFromNetworkSpeed.ts
Created April 26, 2020 08:59 — forked from timc1/getDelayFromNetworkSpeed.ts
Control the speed at which your loading state shows up depending on the user's internet speed.
const defaultDelay = 500;
export default function getDelay(): number {
if (typeof window !== "undefined") {
if (window.navigator && window.navigator.connection) {
const connection = window.navigator.connection.effectiveType;
switch (connection) {
case "4g":
return defaultDelay;
case "3g":
@bricejulia
bricejulia / emojis.json
Created December 18, 2017 08:15 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_biys", "shortname": "", "unicode": "", "html": "&#128104;&zw

Using Git to Manage a Live Web Site

###Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

####Contents

@bricejulia
bricejulia / RFReactSelect.js
Created April 5, 2017 15:22 — forked from leocristofani/RFReactSelect.js
How to integrate React Select with Redux Form
import React, { PropTypes } from 'react';
import Select from 'react-select';
import 'react-select/dist/react-select.css';
RFReactSelect.defaultProps = {
multi: false,
className: ""
};
RFReactSelect.propTypes = {
@bricejulia
bricejulia / background.sh
Last active March 30, 2017 10:03
mac os wallpaper script
#!/usr/bin/env bash
name=$(date '+%y-%m-%d_%H:%M:%S')
wget -O /Users/bjulia/.background/tmp/$name.jpg 'https://unsplash.it/2500/1300?random' > /dev/null 2>&1
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Users/bjulia/.background/tmp/'$name'.jpg"'
rm -f ./tmp/*
@bricejulia
bricejulia / config.yml
Created February 14, 2017 14:34 — forked from tristanbes/config.yml
Session cookie name for Symfony2 and subdomains
framework:
esi: { enabled: true }
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
@bricejulia
bricejulia / prompt_answer.php
Created July 13, 2016 08:14 — forked from j3j5/prompt_answer.php
PHP snippet to prompt for an answer on the CLI.
function prompt_answer($exit = TRUE) {
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
if(trim($line) !== 'y' && !empty(trim($line))) {
fclose($handle);
if($exit) {
echo "ABORTING!" . PHP_EOL;
exit;
} else {
return FALSE;