Skip to content

Instantly share code, notes, and snippets.

View BKeanu1989's full-sized avatar

Kevin Fechner BKeanu1989

View GitHub Profile
@djaiss
djaiss / gist:2938259
Created June 15, 2012 19:13
PHP List of countries
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
@DavidWells
DavidWells / add-wordpress-settings-page.php
Created January 28, 2013 05:59
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@mickaelandrieu
mickaelandrieu / quotes_csv.js
Last active May 19, 2017 15:29
Scrap a website using CasperJs, CSV export
var quotes = 0;
var maxLinks = 5;
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss';
var x = require('casper').selectXPath;
var fs = require('fs');
var utils = require('utils');
var casper = require('casper').create({
verbose: true,
@chrisjhoughton
chrisjhoughton / proxy.apache.conf
Last active September 17, 2024 23:59
Sample Nginx reverse proxy to Apache set up for Wordpress.
<VirtualHost *:{PORT}>
ServerName www.yourdomain.com
ServerAdmin [email protected]
DocumentRoot /var/www/yourdir/
<Directory /var/www/yourdir>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
@corsonr
corsonr / gist:9152652
Last active January 19, 2023 22:41
WooCommerce : add custom fields to product variations
<?php
//Display Fields
add_action( 'woocommerce_product_after_variable_attributes', 'variable_fields', 10, 3 );
//JS to add fields for new variations
add_action( 'woocommerce_product_after_variable_attributes_js', 'variable_fields_js' );
//Save variation fields
add_action( 'woocommerce_process_product_meta_variable', 'save_variable_fields', 10, 1 );
/**
@salcode
salcode / .gitignore
Last active February 10, 2024 10:56
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@manjeshpv
manjeshpv / passport.js
Last active February 29, 2024 15:11
Passport.js using MySQL for Authentication with Express
// config/passport.js
// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
anonymous
anonymous / example_PDF_gen
Created April 14, 2016 12:35
/*
Generates a populated Job Card PDF using the data in the supplied array and returns an application file path to the newly generated PDF.
Requires the inclusion of the util function: 'generateJobCardFDF($inputData)'
*/
function generatePopulatedJobCardPDF($jobCardData){
//Format the form data
$formData['Job_Number']=$jobCardData[''];
$formData['Customer']=$jobCardData[''];
$formData['Description']=$jobCardData[''];
@BKeanu1989
BKeanu1989 / live-to-local-wp.sql
Last active November 29, 2018 13:17
From live to local Wordpress
-- variables: PREFIX; URL; HTDOCS_DIR
-- TODO/TRY UPDATE PREFIXposts SET guid = replace(guid, 'URL', 'http://localhost:8888/HTDOCS_DIR');
UPDATE PREFIXoptions SET option_value = replace(option_value, 'URL', 'http://localhost:8888/HTDOCS_DIR') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE PREFIXposts SET post_content = replace(post_content, 'URL', 'http://localhost:8888/HTDOCS_DIR');
UPDATE PREFIXpostmeta SET meta_value = replace(meta_value, 'URL','http://localhost:8888/HTDOCS_DIR');
@iamstoick
iamstoick / import.md
Created June 14, 2017 05:03
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.