Skip to content

Instantly share code, notes, and snippets.

View knorthfield's full-sized avatar

Kris Northfield knorthfield

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/paperjs/paper.js@0.12.11/dist/paper-full.js"></script>
<script type="text/paperscript" canvas="myCanvas">
var background = new Path.Rectangle(view.bounds);
background.fillColor = 'white';
var think = new Path.Circle(new Point(115, 120), 55);
think.strokeColor = '#B42371';
@knorthfield
knorthfield / scrollBottom.js
Created May 10, 2012 14:56
jQuery detect if scrolled to bottom or near it
$(window).scroll(function(){
toScroll = $(document).height() - $(window).height() - 250;
if ( $(this).scrollTop() > toScroll ) {
// Do something
}
});
@knorthfield
knorthfield / laravel_parse_pasted_spreadsheet.php
Last active January 10, 2019 12:40
Laravel Parse Pasted Spreadsheet
<?php
collect(explode("\n", request()->spreadsheet))
->map(function($row){
return str_getcsv($row, "\t");
})
->each(function($cell) {
// $cell[0], $cell[1] etc
});
@knorthfield
knorthfield / key-nav.html
Created August 7, 2018 13:26
Proof of concept for keyboard nav of search results
<style>
a {
display: block;
}
:focus {
background-color: red;
outline: 0;
}
</style>
<input type="text" id="input" tabindex="0">
@knorthfield
knorthfield / click_connect.js
Last active June 15, 2018 06:49
Mass Connect LinkedIn
// Use in console on https://www.linkedin.com/mynetwork/
$('[data-control-name="connection_connections_connect"]').click();
$('[data-control-name="invite"]').click();
window.location.reload();
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@knorthfield
knorthfield / flip.html
Created September 30, 2012 22:23
CSS Flip Animation
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>CSS Flip</title>
<style type='text/css'>
/* entire container, keeps perspective */
.flip-container {
-webkit-perspective: 1000;
### Keybase proof
I hereby claim:
* I am knorthfield on github.
* I am knorthfield (https://keybase.io/knorthfield) on keybase.
* I have a public key ASCBtEiD0LexEljuEE16WHUP6VUewBlyvyN0hB-waykjBAo
To claim this, I am signing this object:
@knorthfield
knorthfield / avatars.sh
Created September 11, 2017 07:30
Download a sequence of images
#!/bin/bash
for i in $(seq -f "%02g" 1 29)
do
curl -LO https://app.fullstory.com/s/img/avatars/$i@2x.png
done
@knorthfield
knorthfield / datetime_picker.js
Last active February 23, 2017 15:35
iOS like date and time pickers
'use strict';
// Making up for Safari's lack of native date picker
// Trying to ape the iOS one
var mac_os_safari_datetime_picker = {
init: function(){
document.querySelectorAll('input[type="date"]').forEach(function(date_input){
date_input.addEventListener('focus', mac_os_safari_datetime_picker.date.show_date_picker);
date_input.addEventListener('click', function(event){