Skip to content

Instantly share code, notes, and snippets.

@knorthfield
knorthfield / laravel_parse_pasted_spreadsheet.php
Last active Jan 10, 2019
Laravel Parse Pasted Spreadsheet
View laravel_parse_pasted_spreadsheet.php
<?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 Aug 7, 2018
Proof of concept for keyboard nav of search results
View key-nav.html
<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 Jun 15, 2018
Mass Connect LinkedIn
View click_connect.js
// Use in console on https://www.linkedin.com/mynetwork/
$('[data-control-name="connection_connections_connect"]').click();
$('[data-control-name="invite"]').click();
window.location.reload();
View icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:fa4629b035b89d67c97df51ff90fc883
### 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 Sep 11, 2017
Download a sequence of images
View avatars.sh
#!/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 Feb 23, 2017
iOS like date and time pickers
View datetime_picker.js
'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 Nov 10, 2016
PHP basic mailer
View mail.php
<?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 Jul 25, 2016
Setting up Raspberry Pi Status Board
View kiosk.md
@knorthfield
knorthfield / implode.php
Created Jul 21, 2016
Make text from array with keys
View implode.php
$message = implode("\n", array_map(function ($v, $k) { return $k . ': ' . $v; }, $_POST, array_keys($_POST)));