Skip to content

Instantly share code, notes, and snippets.

View jackmcpickle's full-sized avatar

Jack McNicol jackmcpickle

View GitHub Profile
@jackmcpickle
jackmcpickle / player.js
Created July 7, 2015 14:53
my player.js from warriorjs challenge
class Player {
playTurn(warrior) {
this.dir = 'backward';
this.warrior = warrior;
this.saw = warrior.look(this.dir);
this.checkSpaceBeforeAction();
this.saveCurrentHealth();
}
@jackmcpickle
jackmcpickle / ajaxsubscribe.html
Last active November 26, 2015 04:27 — forked from jdennes/LICENSE
Subscribing to a Campaign Monitor list using AJAX
<!-- 1. Take your Campaign Monitor subscribe form as generated from within your account: -->
<form action="http://myaccount.createsend.com/t/r/s/aljhk/" method="post" id="cm_form">
<div>
<label for="name">Name:</label><br /><input type="text" name="cm-name" id="name" required /><br />
<label for="aljhk-aljhk">Email:</label><br /><input type="email" name="cm-aljhk-aljhk" id="aljhk-aljhk" required /><br />
<button type="submit" class="button" id="submit_form" disabled>Subscribe</button>
<p id="message"></p>
</div>
</form>
@jackmcpickle
jackmcpickle / craft-update.sh
Last active July 11, 2017 16:29
manually update craft cms
#!/bin/bash
################################################################
# craft-update
# Searches and cleans latest craftcms url from craftcms.com
# Downloads and replaces existing craft app folder
# Also checks you agree to craftcms terms
################################################################
set -e
# Check that path to craft folder is there
@jackmcpickle
jackmcpickle / Dockerfile
Last active July 24, 2019 19:22
Our Craft CMS docker-compose dev setup
FROM sealink/craftdocker:2.6.2791
# install plugins
COPY composer.json /app/
COPY composer-post-install /app/
COPY vendor /app/vendor
RUN composer install
# node packages
COPY package.json /app/
@jackmcpickle
jackmcpickle / email-validation.js
Created April 27, 2016 05:32
Ajax Email validation
var $contactForm = $('#contactForm'),
$submitButton = $('#submitForm'),
$message = $('.js-error-messages'),
$honeypot = $('.js-honey'),
$emailField = $('.js-email-field');
var resetButton = function(timeout) {
setTimeout(function() {
$submitButton.text('Send').prop('disabled', false);
}, timeout);
@jackmcpickle
jackmcpickle / .sass-lint.yml
Created May 17, 2016 02:19
My Sass Lint config
files:
include: '**/*.scss'
options:
formatter: stylish
merge-default-rules: falserailing-semicolon
rules:
bem-depth:
- 0
- max-depth: 1
border-zero:
@jackmcpickle
jackmcpickle / scrollSpy.ts
Created October 17, 2017 23:36
an working but buggy attempt at using IntersectionObserver to scrollSpy
import throttle from 'lodash/throttle';
import map from 'lodash/map';
class ScrollSpy
{
$targets: Element[];
$navItems: JQuery<HTMLElement>;
observer: IntersectionObserver;
threshold: number;
activeClass: string;
@jackmcpickle
jackmcpickle / attach_to_post.php
Created March 18, 2018 06:02
attach media that was uploaded in post as thumbnails
<?php
add_action('init', 'update_business_thumbnails');
function update_business_thumbnails()
{
if (!isset($_GET['update_thumbnails'])) return ;
$args = [
'post_type' => 'attachment',
{
init: function(elevators, floors) {
this.elevator = elevators[0]; // Let's use the first elevator
this.setupListeners(floors)
},
update: function(dt, elevators, floors) {
this.checkIndicators()

Keybase proof

I hereby claim:

  • I am jackmcpickle on github.
  • I am jackmcpickle (https://keybase.io/jackmcpickle) on keybase.
  • I have a public key ASA6l_H5wRrcj_wNXT9I9lGKy80urTP9usBAcZMIFCXjLwo

To claim this, I am signing this object: