Skip to content

Instantly share code, notes, and snippets.

We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"http://www.walmart.com"
"http://www.exxonmobil.com"
"http://www.chevron.com"
"http://www.berkshirehathaway.com"
"http://www.apple.com"
"http://www.gm.com"
"http://www.phillips66.com"
"http://www.ge.com"
"http://www.ford.com"
"name","industry","sector","website","rank"
"Walmart","General Merchandisers","Retailing","http://www.walmart.com",1
"Exxon Mobil","Petroleum Refining","Energy","http://www.exxonmobil.com",2
"Chevron","Petroleum Refining","Energy","http://www.chevron.com",3
"Berkshire Hathaway","Insurance: Property and Casualty (Stock)","Financials","http://www.berkshirehathaway.com",4
"Apple","Computers, Office Equipment","Technology","http://www.apple.com",5
"General Motors","Motor Vehicles and Parts","Motor Vehicles & Parts","http://www.gm.com",6
"Phillips 66","Petroleum Refining","Energy","http://www.phillips66.com",7
"General Electric","Diversified Financials","Financials","http://www.ge.com",8
"Ford Motor","Motor Vehicles and Parts","Motor Vehicles & Parts","http://www.ford.com",9
@hartliddell
hartliddell / knight-moves.js
Created October 5, 2016 15:10
Toptal Codility Problem: Can Knight reach square?
'use strict';
function getNextPositions(start) {
var moves = [
{ x: -2, y: -1 },
{ x: -2, y: +1 },
{ x: -1, y: -2 },
{ x: -1, y: +2 },
{ x: +1, y: -2 },
{ x: +1, y: +2 },
@hartliddell
hartliddell / custom-fields.php
Last active July 27, 2016 14:18
Add ACF fields via php. Add notice in CMS that this is how ACF fields are being loaded.
<?php
// load custom fields
require_once 'custom-fields--layouts.php';
require_once 'custom-fields--meta.php';
require_once 'custom-fields--press.php';
require_once 'custom-fields--press-items.php';
require_once 'custom-fields--room.php';
// put message in ACF interface to warn people to edit custom fields here
@hartliddell
hartliddell / InfiniteScroll-ES6.js
Created May 7, 2016 20:52 — forked from ChrisLTD/InfiniteScroll-ES6.js
Infinite "Scroll" javascript module for ES6
'use strict';
// Infinite scrolling loader, fires off a button click
//
// Sample HTML:
// <div id="infinite-scroll" class="js-infinite-scroll">
// POSTS HERE
// <a href="/url-to-more-content" class="js-infinite-scroll-next-button">Load More</a>
// </div>
// <div class="js-infinite-scroll-loading">...</div>
@hartliddell
hartliddell / Google-Sheet-Form-Post.md
Created October 14, 2015 18:03 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Run example

You should be able to just open index.html in your browser and test locally.

However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000

console.log("Puppies!");
/*
* Data from WeatherUnderground for
* forecast_for("NY","New York")
*/
{
"response" => {
"version" => "0.1",
"termsofService" => "http://www.wunderground.com/weather/api/d/terms.html",
"features" => {
"forecast" => 1
@hartliddell
hartliddell / migrate.php
Created February 9, 2015 23:28
Wordpress Migrate Script
<?php
/**
* Function migrateV2 updates Database tables values: site_ul, home, domain, post url
*
* @param string $urlToReplace migrate from http://xsite.com to htttp://ysite.com
*/
function migrateV2($urlToReplace){
global $table_prefix;
$error = false;