Skip to content

Instantly share code, notes, and snippets.

View monkeymonk's full-sized avatar
😶
β+∂(ℤ²-i)ℕ×g³=α!

Stéphan Zych monkeymonk

😶
β+∂(ℤ²-i)ℕ×g³=α!
View GitHub Profile
@monkeymonk
monkeymonk / Notice.php
Last active December 17, 2020 09:53
Wordpress Admin Notice Helper Class #wordpress
<?php
/**
* Helper to work with Wordpress admin notices
*
* @example
* Notice::success('All is good!');
*
* @example
* Notice::warning('Do something please.', true);
@monkeymonk
monkeymonk / cookies.js
Created May 11, 2016 15:27 — forked from ajaxray/cookies.js
Small JavaScript class to help create, read and delete cookie.
/**
* Cookies - A small class to manipulate cookies from javascript
*
* Compressed version: https://gist.github.com/4147384
*
* @see www.quirksmode.org/js/cookies.html
* @author Anis uddin Ahmad <[email protected]>
*/
window.Cookies = {
@monkeymonk
monkeymonk / Helpers.php
Last active April 9, 2019 06:54
Wordpress Helpers class #wordpress
<?php
use Illuminate\Validation\Factory as ValidatorFactory;
use Symfony\Component\Translation\Translator;
/**
* Class Helpers
*
* Some useful methods
*
* @see https://github.com/MozaikAgency/wp-theme-starter/blob/master/theme/
@monkeymonk
monkeymonk / jquery.promise.js
Last active February 25, 2020 10:58
Promise facade from jQuery Deferred
/**
* Promise facade from jQuery Deferred
*
* @example
* function fetch(timeout = 0) {
* return promise(function (resolve, reject) {
* if (timeout) {
* setTimeout(resolve, timeout);
* } else {
* reject();
@monkeymonk
monkeymonk / pagination.vue
Created July 28, 2016 09:22 — forked from vinicius73/pagination.vue
VueJS Pagination directive
<template>
<ul class="pagination">
<li v-show="current_page != 1">
<a href="javascript:;"
aria-label="Previous"
v-on:click="previousPage()">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<li v-for="page in total_pages"
@monkeymonk
monkeymonk / gource-commands.txt
Created July 29, 2016 18:12 — forked from rafi/gource-commands.txt
Gource command
################################
gource commands
################################
# basic command for big and long projects
gource --max-user-speed 500 --seconds-per-day 0.05 --file-idle-time 10 -e 0.005 -f --max-files 300 --hide-files
# some easy to understand commands
# for output file
--output-ppm-stream ~/ppm/ppm-kohana
@monkeymonk
monkeymonk / bootstrap-sass-mixin-cheatsheet.scss
Last active April 9, 2019 06:52 — forked from anthonyholmes/bootstrap-sass-mixin-cheatsheet.scss
Bootstrap Sass Mixin Cheatsheet #resources
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@monkeymonk
monkeymonk / helpers.php
Last active April 9, 2019 06:48
Wordpress Useful Helpers #wordpress
<?php
if (!function_exists('add_actions')) {
function add_actions(array $tags, $function, $priority = 10, $accepted_args = 1)
{
foreach ($tags as $tag) {
add_action($tag, $function, $priority, $accepted_args);
}
}
}
@monkeymonk
monkeymonk / PHP Countries Array
Last active April 9, 2019 06:53 — forked from DHS/PHP Countries Array
PHP array of all country names #resources
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551