Skip to content

Instantly share code, notes, and snippets.

View knorthfield's full-sized avatar

Kris Northfield knorthfield

View GitHub Profile
@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.
### 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){
@knorthfield
knorthfield / mail.php
Created November 10, 2016 16:03
PHP basic mailer
<?php
if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
$message = implode("\n", array_map(function ($v, $k) { return $k . ': ' . $v; }, $_POST, array_keys($_POST)));
$headers = 'From: contact_form@example.com';
mail('info@example.com', 'Website Contact Form', $message, $headers);
header("Location: http://www.example.com/thankyou");
die();
}
?>
@knorthfield
knorthfield / kiosk.md
Last active July 25, 2016 15:21
Setting up Raspberry Pi Status Board
@knorthfield
knorthfield / implode.php
Created July 21, 2016 16:58
Make text from array with keys
$message = implode("\n", array_map(function ($v, $k) { return $k . ': ' . $v; }, $_POST, array_keys($_POST)));