Skip to content

Instantly share code, notes, and snippets.

View veksen's full-sized avatar
:octocat:
Focusing

Jean-Philippe Sirois veksen

:octocat:
Focusing
View GitHub Profile
@gaearon
gaearon / MyResponsiveComponent.js
Created November 1, 2018 10:05
Examples from "Making Sense of React Hooks"
function MyResponsiveComponent() {
const width = useWindowWidth(); // Our custom Hook
return (
<p>Window width is {width}</p>
);
}
<?php
class evidenceController {
public function getDetails($id){
$course = Course::with(['courseType'])
->checkEstablishmentOnView()
->excludeArchived()
->findOrFail($id);
$view = View::make('courses/parts/details')
->with('course', $course);
@mercuryseries
mercuryseries / EditAccountRequest.php
Created November 29, 2016 18:19
EditAccountRequest.php
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rule;
class EditAccountRequest extends FormRequest
@santerref
santerref / sync.sh
Last active April 12, 2021 17:20
Simple bash script to synchronize your WordPress dev (local) with your staging or production.
#/bin/bash
REMOTE_URL="https://staging.example.com"
LOCAL_URL="http://example.dev"
REMOTE_PATH="/home/staging_example/public_html"
LOCAL_PATH="/var/www/example.dev"
SSH_HOST="user@staging.example.com"
@mblarsen
mblarsen / cdr.sh
Last active November 28, 2016 04:22
A small shell command like `cd` that cd-s you back to project root.
#!/bin/bash
#
# A small script that works like `cd` except that
# it keeps cd-ing until it reachs the project root
# project is defined by default as the directory
# that contains a .git sub-directory.
#
# Change this behavior like this:
# CDR_ROOT_ID=composer.json
<template>
<select name="name" class="form-control" v-model="value">
<option :value="null" :selected="value === null">{{noProgrammer}}
</option>
<option v-for="(user_id, user_name) in apiProgrammers.data"
:value="user_id" :selected="value == user_id"
v-text="user_name"></option>
</select>
</template>
# make sure you only commit this file and int-call-codes-full-native-names to github
import json
def get_by_attr(test_list, attr, attr_val):
for x in test_list:
if x[attr] == attr_val:
break
else:
x = None
@colingourlay
colingourlay / example.js
Last active October 22, 2021 15:16
Lodash / Underscore sort object keys. Like _.sortBy(), but on keys instead of values, returning an object, not an array. Defaults to alphanumeric sort.
var obj = {b: 3, c: 2, a: 1};
_.sortKeysBy(obj);
// {a: 1, b: 3, c: 2}
_.sortKeysBy(obj, function (value, key) {
return value;
});
// {a: 1, c: 2, b: 3}
@andyj
andyj / html_for_international_calling coes.htm
Created October 22, 2013 21:57
HTML <select> international calling codes for each country
<!-- country codes (ISO 3166) and Dial codes. -->
<select name="countryCode" id="">
<option data-countryCode="GB" value="44" Selected>UK (+44)</option>
<option data-countryCode="US" value="1">USA (+1)</option>
<optgroup label="Other countries">
<option data-countryCode="DZ" value="213">Algeria (+213)</option>
<option data-countryCode="AD" value="376">Andorra (+376)</option>
<option data-countryCode="AO" value="244">Angola (+244)</option>
<option data-countryCode="AI" value="1264">Anguilla (+1264)</option>
<option data-countryCode="AG" value="1268">Antigua &amp; Barbuda (+1268)</option>
@plentz
plentz / nginx.conf
Last active May 5, 2026 07:20
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048