Skip to content

Instantly share code, notes, and snippets.

View jasondavis's full-sized avatar

Jason Davis jasondavis

View GitHub Profile
@jasondavis
jasondavis / List.md
Created December 11, 2016 20:43 — forked from msurguy/List.md
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@jasondavis
jasondavis / frontendDevlopmentBookmarks.md
Created November 11, 2016 04:40 — forked from dabonka/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
<?php
//connection details
$host = 'localhost';
$dbname = 'database name';
$dbusername = 'database username';
$password = 'db password';
//make a connection
$db = new PDO("mysql:$host=;port=8889;$dbname=", $dbusername, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@jasondavis
jasondavis / Logger.js
Created October 22, 2016 14:43 — forked from AndersDJohnson/Logger.js
dom logger / jsfiddle
(function(context){
// don't call until domready
var getDefaultElement = (function () {
var defaultElement;
return function () {
if (typeof defaultElement == 'undefined') {
defaultElement = document.createElement('div');
document.body.appendChild(defaultElement);
}
return defaultElement;
@jasondavis
jasondavis / Tags.php
Created October 15, 2016 01:20 — forked from asaokamei/Tags.php
PHP HTML Tag Generator Class.
<?php
/**
* @method Tags a()
* @method Tags href()
* @method Tags target()
* @method Tags style()
* @method Tags div()
* @method Tags input()
* @method Tags value()
@jasondavis
jasondavis / sample06_1.php
Created October 12, 2016 18:17 — forked from phpfiddle/sample06_1.php
PHP, PDO and SQLite2 example
<?php
/**
* PHP, PDO and SQLite2 example
* The code got from Internet
*
*/
// Set default timezone
date_default_timezone_set('UTC');
@jasondavis
jasondavis / WordPress Conditional Custom Meta Box
Created October 11, 2016 08:54 — forked from WagnerMatos/WordPress Conditional Custom Meta Box
WordPress Custom Meta Box that can used only on certain post types, pages, etc.
<?php
/*/////////////////////////////////////////////////////////////////////////////////////
//// Load scripts and styles for Meta box */
// enqueue scripts and styles, but only if is_admin
if(is_admin()) {
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('custom-js', get_template_directory_uri().'/library/metaboxes/js/custom-js.js');
wp_enqueue_style('jquery-ui-custom', get_template_directory_uri().'/library/metaboxes/css/jquery-ui-custom.css');
@jasondavis
jasondavis / gist:35b2c9ec62c985b71fbb8ac74a673c7b
Created September 8, 2016 19:00 — forked from amedeo/gist:820412
CouchDB and multiple tags

CouchDB and multiple tags

The problem

Given a set of documents, each associated with multiple tags, how can I retrieve the documents tagged with an arbitrary set of tags?

My solution

SQLite3 Electron windows integration

This guide is based on the very informative discussion in this article: Using node_sqlite3 with Electron

Install sqlite3

npm install sqlite3 --save
<?php
/**
* Recursively search an array for a given value. Returns the root element key if $needle
* is found, or FALSE if $needle cannot be found.
*
* @param mixed $needle
* @param array $haystack
* @param bool $strict
* @return mixed|bool