Skip to content

Instantly share code, notes, and snippets.

View kferran's full-sized avatar

Kyle Ferran kferran

View GitHub Profile
@kferran
kferran / 000-default.conf
Last active November 3, 2017 00:05
vhost bundle of ssl and regular
<VirtualHost *:443>
ServerAdmin admin@example.com
DocumentRoot /var/www/html
ServerName example.com
ServerAlias www.example.com
SSLEngine on
SSLCertificateFile /address/of/your/certificate.crt
SSLCertificateKeyFile /address/of/your/keyfile.key
SSLCACertificateFile /address/of/your/certificate_chain_file.crt
<Directory /var/www/html>
@kferran
kferran / Module starter
Created January 20, 2017 00:43
Processwire module starter
class YourModule extends WireData implements Module, ConfigurableModule {
public static function getModuleInfo() {
return array('title' => 'Your Module', 'version' => 1);
}
const defaultValue = 'renobird';
public function __construct() {
$this->set('yourname', self::defaultValue); // set default value in construct
@kferran
kferran / from.php
Created July 11, 2016 03:50 — forked from somatonic/from.php
Create a page edit form on frontend using PW API and fields from the template of the page
<?php
// get a page
$editpage = $pages->get("/editme/");
$ignorefields = array("isOld","language_published");
$form = $modules->get("InputfieldForm");
$form->method = 'post';
$form->action = './';
@kferran
kferran / gulpfile.js
Created November 13, 2015 19:16 — forked from mlouro/gulpfile.js
gulpfile.js with browserify, jshint, libsass, browserSync for livereload, image optimization and system notifications on errors
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');
@kferran
kferran / wp-init.sh
Last active August 29, 2015 14:07
wp-init
echo "Installing WordPress using WP CLI"
cd /vagrant
wp core download
wp core config --dbname="wordpress" --dbuser=root --dbpass=root --dbhost="localhost"
@kferran
kferran / gist:9212568
Last active August 29, 2015 13:56
Install WP-CLI
git clone git://github.com/wp-cli/wp-cli.git /home/vagrant/wp-cli
cd /home/vagrant/wp-cli
composer install
# Link `wp` to the `/usr/local/bin` directory
sudo ln -sf /home/vagrant/wp-cli/bin/wp /usr/local/bin/wp
#!/usr/bin/env bash
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
# Install base items
@kferran
kferran / vhost
Created October 8, 2013 16:49 — forked from gistwebdev/vhost
#!/bin/bash
#
# Display usage info
vhost-usage() {
cat <<"USAGE"
Usage: vhost [OPTIONS] <name>
-h|--help this screen
-pub to create the webhost root in ~/www/name/public/
-url to specify a local address, default is http://name.local
@kferran
kferran / ScrollTO
Last active December 22, 2015 04:29
If you want the URL to be updated, do it within the animate callback:
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {