Skip to content

Instantly share code, notes, and snippets.

View jveldboom's full-sized avatar

John Veldboom jveldboom

View GitHub Profile
@jveldboom
jveldboom / json.lua
Last active October 9, 2015 06:38
Heka JSON Decoder
require "cjson"
local dt = require "date_time"
--[[
From trink in IRC - thanks!
Example use:
[HttpListenInput]
address = "0.0.0.0:8325"
@jveldboom
jveldboom / readme.md
Last active March 18, 2018 20:37
Unbuntu 14.04 Vagrant LEMP + Laravel
### Download setup Ubuntu 14.04 box
```
// from local directory
vagrant init chef/ubuntu-14.04
```
### Setup Vagrantfile
```
# -*- mode: ruby -*-
# vi: set ft=ruby :
@jveldboom
jveldboom / class.onixSplitter.php
Created March 11, 2014 15:13
Split ONIX files into smaller chunks
<?php
class onixSplitter
{
function split($file,$header,$footer,$split_at=2000)
{
$this->file = $file;
$this->header = $header;
$this->footer = $footer;
$this->split_at = $split_at;
$this->write_num = 1; // starting number for files written
@jveldboom
jveldboom / bisac.csv
Created September 12, 2013 18:52
BISAC codes and values
ANT000000 Antiques & Collectibles / General
ANT001000 Antiques & Collectibles / Americana
ANT002000 Antiques & Collectibles / Art
ANT003000 Antiques & Collectibles / Autographs
ANT005000 Antiques & Collectibles / Books
ANT006000 Antiques & Collectibles / Bottles
ANT007000 Antiques & Collectibles / Buttons & Pins
ANT008000 Antiques & Collectibles / Care & Restoration
ANT009000 Antiques & Collectibles / Transportation
ANT010000 Antiques & Collectibles / Clocks & Watches
@jveldboom
jveldboom / gist:6481874
Created September 8, 2013 04:37
quick example
<?php
require_once app_path().'/libraries/google-api-php-client/src/Google_Client.php';
require_once app_path().'/libraries/google-api-php-client/src/contrib/Google_AnalyticsService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName("Google Analytics PHP Starter Application");
// Visit https://code.google.com/apis/console?api=analytics to generate your
@jveldboom
jveldboom / class.move_db_files.php
Last active December 22, 2015 13:19
PHP class to move database files (like MYD, MYI and frm)
<?php
/*
|--------------------------------------------------------------------------
| Move Database Files (like MYD, MYI and frm)
|--------------------------------------------------------------------------
|
| $config = array(
| 'tables' => array('table1','table2'), // array of tables / filenames to move
| 'extensions' => array('MYD','MYI','frm'), // required extensions for each database
| 'from' => dirname(__DIR__).'/transfer', // from location of files
@jveldboom
jveldboom / onix_code_list.sql
Created July 26, 2013 13:38
ONIX fields and values SQL
DROP TABLE IF EXISTS `onix_code_list`;
CREATE TABLE `onix_code_list` (
`list_id` int(11) unsigned NOT NULL,
`values` varchar(20) DEFAULT NULL,
`name` varchar(100) DEFAULT '',
`notes` text,
`revision` int(11) unsigned DEFAULT NULL,
KEY `list_id` (`list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@jveldboom
jveldboom / gist:6051179
Created July 22, 2013 03:45
Fade In & Out the Most Recent Pictures in a Directory with jQuery
<?php
// Global Variables
$image_dir = "$_SERVER[DOCUMENT_ROOT]/examples/imgs"; // directory on server
$image_relative_path = '/examples/imgs'; // path to images relative to script
$file_types = array('jpg','jpeg','gif','png');
$image_time = '4000'; // seconds each image will display (4000 = 4 seconds)
if($handle = opendir($image_dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
@jveldboom
jveldboom / content_load.js
Created June 23, 2013 01:31
Simple Content Load on Scroll
var loading = false;
$(window).scroll(function(){
if((($(window).scrollTop()+$(window).height())+250)>=$(document).height()){
if(loading == false){
loading = true;
$('#loadingbar').css("display","block");
$.get("load.php?start="+$('#loaded_max').val(), function(loaded){
$('body').append(loaded);
$('#loaded_max').val(parseInt($('#loaded_max').val())+50);
$('#loadingbar').css("display","none");
@jveldboom
jveldboom / smooth_scrolling.js
Created June 23, 2013 01:28
Smooth scrolling to #anchor
// HTML:
// <h1 id="anchor">Lorem Ipsum</h1>
// <p><a href="#anchor" class="topLink">Back to Top</a></p>
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"