Skip to content

Instantly share code, notes, and snippets.

@jgdoncel
jgdoncel / create_calendar_table.sql
Created March 22, 2024 11:53 — forked from vetali/create_calendar_table.sql
Calendar table for MySql
SET FOREIGN_KEY_CHECKS = 0;
/* Drop Tables */
DROP TABLE IF EXISTS calendar CASCADE;
/* Create Tables */
CREATE TABLE calendar (
id DATE NOT NULL,
year SMALLINT NOT NULL,
@jgdoncel
jgdoncel / Module.js
Created January 21, 2019 11:37 — forked from sdd/Module.js
Javascript Module pattern template. Shows a class with a constructor and public/private methods/properties. Also shows compatibility with CommonJS(eg Node.JS) and AMD (eg requireJS) as well as in a browser.
/**
* Created with JetBrains PhpStorm.
* User: scotty
* Date: 28/08/2013
* Time: 19:39
*/
;(function(global){
"use strict";
var M = function() {
@jgdoncel
jgdoncel / vanilla-js-plugin.js
Created May 10, 2018 09:08 — forked from cferdinandi/vanilla-js-plugin.js
My starter template for vanilla JavaScript plugins.
(function (root, factory) {
if ( typeof define === 'function' && define.amd ) {
define([], factory(root));
} else if ( typeof exports === 'object' ) {
module.exports = factory(root);
} else {
root.myPlugin = factory(root);
}
})(typeof global !== 'undefined' ? global : this.window || this.global, function (root) {
@jgdoncel
jgdoncel / Function.Array-Group-By.php
Last active November 18, 2016 11:56 — forked from mcaskill/Function.Array-Group-By.php
PHP : Groups an array by a given key
<?php
if ( ! function_exists('array_group_by') ) :
/**
* Groups an array by a given key.
*
* Groups an array into arrays by a given key, or set of keys, shared between all array members.
*
* Based on {@author Jake Zatecky}'s {@link https://github.com/jakezatecky/array_group_by array_group_by()} function.
<?php
function tailCustom($filepath, $lines = 1, $adaptive = true) {
// Open file
$f = @fopen($filepath, "rb");
if ($f === false) return false;
// Sets buffer size
if (!$adaptive) $buffer = 4096;
@jgdoncel
jgdoncel / .htaccess
Created October 2, 2013 21:46 — forked from pbougie/.htaccess
Set time zone to Coordinated Universal Time (UTC) for PHP in an .htaccess file.
php_value date.timezone UTC