Skip to content

Instantly share code, notes, and snippets.

View ipatate's full-sized avatar
🏠
Working from home

Patrick Faramaz ipatate

🏠
Working from home
View GitHub Profile
@karantir
karantir / index.js
Created January 26, 2019 09:09
Play sound with Howler from blob stored in IndexedDB
(function () {
// IndexedDB
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB,
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction,
dbVersion = 2.0;
// Create/open database
var request = indexedDB.open("soundScapeFiles", dbVersion),
db,
createObjectStore = function (dataBase) {
@zgordon
zgordon / webpack.config.js
Created September 14, 2018 16:16
A Gutenberg webpack configuration file
const path = require( 'path' );
const webpack = require( 'webpack' );
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
// Set different CSS extraction for editor only and common block styles
const blocksCSSPlugin = new ExtractTextPlugin( {
filename: './assets/css/blocks.style.css',
} );
const editBlocksCSSPlugin = new ExtractTextPlugin( {
filename: './assets/css/blocks.editor.css',
@tankbar
tankbar / functions.php
Created December 14, 2017 10:50
WooCommerce - Add GTIN/EAN meta field for product and product variations
/**
* Adding Custom GTIN Meta Field
* Save meta data to DB
*/
// add GTIN input field
add_action('woocommerce_product_options_inventory_product_data','woocom_simple_product_gtin_field', 10, 1 );
function woocom_simple_product_gtin_field(){
global $woocommerce, $post;
$product = new WC_Product(get_the_ID());
echo '<div id="gtin_attr" class="options_group">';
@gpbeer
gpbeer / archive.php
Created July 15, 2017 19:38
Timber Taxonomy term list
<?php
$templates = ['views/pages/archive.twig'];
$context = Timber::get_context();
$context['title'] = 'Archive';
// If is Tax 'Type'
if (is_tax('type')) {
// We pass the title
@andrewstobbe
andrewstobbe / MacOSXSierra:Brew+Apache+Mysql+PHPSwitcher+DNSMasq+SSL.md
Last active July 19, 2021 02:12
Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL

Mac OSX Sierra : Brew Apache + Mysql + PHP Switcher + DNSMasq + SSL 👍

Things I had to do using Homebrew to get my local web dev environment back up and running after migration to OSX Sierra + Xcode 8.1.

Note: I used brew reinstall because I had already installed most of this previously under Yosemite. Probably better ways to do this, but this is what worked for me.

brew doctor

brew tap homebrew/dupes
brew tap homebrew/versions
@julienbourdeau
julienbourdeau / prestashop.conf
Created May 4, 2016 14:23
PrestaShop Nginx Configuration
server {
listen 80;
listen [::]:80; #Use this to enable IPv6
server_name www.example.com;
root /var/www/prestashop17;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html;
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {
@Ciantic
Ciantic / gist:8a09107fcd9bed8bede0
Created June 24, 2014 16:41
WordPress select and checkboxes metabox callback
<?php
/**
* Show taxonomy selection in WordPress admin as single <select> box or checkboxes
*
* @author Jari Pennanen / https://github.com/ciantic
* @license Public Domain
**/
// Usage example:
register_taxonomy("my_taxonomy", array("post"), array(
@jbmoelker
jbmoelker / bootstrap.js
Last active January 15, 2016 19:22
requirejs-bootstrap-plugin
// Create shim for requested bootstrap component and require
// and return jQuery so you do not have to inject it separately
// every time you use a bootstrap component.
define({
load: function (name, req, onload, config) {
// Set this path to wherever the bootstrap components live.
// Contents should match https://github.com/twbs/bootstrap/tree/master/js
var component = 'path/to/bootstrap/js/'+name;
var shim = {};
@codler
codler / flex.less
Last active October 7, 2023 07:01
Prefix flex for IE10 and Safari / iOS in LESS
/*! Prefix flex for IE10 and Safari / iOS in LESS
* https://gist.github.com/codler/2148ba4ff096a19f08ea
* Copyright (c) 2014 Han Lin Yap http://yap.nu; MIT license */
.display(@value) when (@value = flex) {
display: -ms-flexbox; // IE10
display: -webkit-flex; // Safari / iOS
}
.display(@value) when (@value = inline-flex) {