Skip to content

Instantly share code, notes, and snippets.

View jongacnik's full-sized avatar

Jon jongacnik

View GitHub Profile
@ivanoats
ivanoats / fetch-from-contentful.js
Created June 17, 2016 18:45
fetch-from-contentful.js
#!/usr/bin/env babel-node
require('dotenv').config()
import contentful from 'contentful'
import fs from 'fs-extra-promise'
// Contentful Config
const apiToken = process.env.CONTENTFUL_DELIVERY_API_TOKEN
const spaceId = process.env.CONTENTFUL_SPACE_ID
const client = contentful.createClient({ accessToken: apiToken, space: spaceId })
@jonathantneal
jonathantneal / README.md
Last active December 13, 2024 20:50
CSS Modules in PHP

CSS Modules lets you write and use simple class names rather than remembering and maintaining long unique class names for every component. CSS Modules mutates all of your classnames from each partials into new, completely unique classnames that will not conflict when they are bundled together into your main CSS file. Then, a JSON file is generated that maps the happy classnames from each file to the unique classname in the combined file. You load this map in PHP, and begin using the easy-to-remember classnames as you wish.

@aaemnnosttv
aaemnnosttv / mamp-to-valet.md
Last active March 1, 2023 14:40
MAMP to Valet

MAMP to Valet

One-time Dependency Setup/Configuration

Install Composer

wget https://getcomposer.org/download/1.1.0/composer.phar && chmod +x composer.phar && sudo mv /usr/local/bin/composer && composer self-update
@bcole808
bcole808 / wp-router.php
Created June 2, 2015 20:54
WordPress PHP Router
<?php
######### router.php #########
#
# This file implements basic server routing and rewrite rules;
# Run the following command from the project root:
#
# php -S localhost:5000 -t path/to/wordpress path/to/router.php
#
# ^ hostname ^ root ^ server router
@jackabox
jackabox / handyWooFunctions.md
Last active August 17, 2022 19:23
Handy Snippets for WooCommerce

Handy Functions for Manipulating WooCommerce

So far the following areas are covered in this gist:

  • Removing tabs on the product page.
  • Cleaning the WooCommerce loading of scripts/styles on pages with no woo elements.
  • Changing the call order of features on the single product.
  • Removing all WooCommerce called styles.
  • Ajaxifying the cart add
@cowboy
cowboy / ctor-return-function.js
Last active July 8, 2018 03:23
JavaScript: Constructor returning a "function" instance.
var util = require("util");
function Thing() {
// The instance is also a proxy function for its __default method.
var instance = function() {
return instance.__default.apply(instance, arguments);
};
// The instance needs to inherit from Thing.prototype.
instance.__proto__ = Thing.prototype;
// Initialize the instance with the __ctor method.
@paulirish
paulirish / bling.js
Last active February 18, 2025 14:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@jb510
jb510 / pretty-php-date-ranges.php
Last active June 25, 2019 05:06
Pretty PHP Date Ranges
<?php
/**
* Verbose Beautified Date Range
*
* @access public
* @param mixed $start_date
* @param mixed $end_date
* @return $date_range (beautified date range)
* @license WTFPL
*
@edheltzel
edheltzel / ADD_SFTP_User.md
Last active December 2, 2024 07:56
Steps to create a new SSH user and SFTP user

How to add a SFTP user to your VM managed by ServerPilot control panel using Ubuntu 14.04

I am not a security expert, so take it for what its worth.

OpenSSH has this ability built in, few people just seem to use the feature. Below is what works for me, but if you have a better way please share the uninformed.

The Steps:

  1. First create a new app inside of the SP control panel
  2. Now, decide what direcoty you want to put the users directory; either `` or /public. This will keep trolls at bay.
@nuxodin
nuxodin / php Scalar Type Hints.php
Last active December 14, 2016 23:11
I would welcome php like this
<?php
// Stirct types
function test(string $name, int $age, float $cuteness, bool $evil) {
//....
}
// Convert types
function test((string)$name, (int)$age, (float)$cuteness, (bool)$evil) {
//....