Skip to content

Instantly share code, notes, and snippets.

View ScottSmith95's full-sized avatar

Scott Smith ScottSmith95

View GitHub Profile
@ScottSmith95
ScottSmith95 / Share-Sheet.html
Last active October 22, 2021 13:40
A responsive web version of iOS Share Sheets. More info: https://ScottHSmith.com/projects/share-sheets/
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
font: normal 300 1em sans-serif;
}
@ScottSmith95
ScottSmith95 / Dropdown.js
Last active June 27, 2017 02:55
Designed for WordPress themes, this script adds a class ("open," by default) to menu items with children when their child link is clicked. Parent elements with links can still be accessed once their class is set to "open". The "open" class is removed when another (non-child) list item is selected. This is designed to work on IE 10+ and other mod…
/**
* A module for handling dropdown menus in Decode.
* @module DecodeDropdown
* @version 1.0.0
* @author Scott Smith <[email protected]>
*/
var DecodeDropdown = ( function () {
'use strict';
/**
@ScottSmith95
ScottSmith95 / customuploads.php
Created February 16, 2014 05:52
A script for custom image uploads via Tweetbot or any other app that uses a similar format. Creates short file names for uploaded items that are essentially unique by using the time and date uploaded (see line 22, 23). Adapted from http://www.macstories.net/news/tweetbot-for-mac-review/#customuploads.
<?php
$domain = "img.scottshar.es/";
//server-side directory
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
$uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self;
// Image filetype check source:
// http://designshack.net/articles/php-articles/smart-file-type-detection-using-php/
$tempFile = $_FILES['media']['tmp_name'];
@ScottSmith95
ScottSmith95 / gist:4529ea5ed9cec02e55bd
Created August 5, 2014 23:16
Keybase Verification
### Keybase proof
I hereby claim:
* I am ScottSmith95 on github.
* I am scottsmith (https://keybase.io/scottsmith) on keybase.
* I have a public key whose fingerprint is 6D0E B01E A1E7 EE3C 8F08 F470 D589 9DEB 2F7E 8D8E
To claim this, I am signing this object:
@ScottSmith95
ScottSmith95 / functions.php
Last active August 29, 2015 14:22
Decode Replace Styles
<?php
/*
* This functon allows a child theme to avoid incurring the performance penalty
* of using a CSS @import in a nearly empty child theme.
* Instead, use this function in the child theme's functions.php file and use
* a plugin like Jetpack to add Custom CSS to your theme.
*/
function decode_child_styles() {
@ScottSmith95
ScottSmith95 / functions.php
Created June 4, 2015 22:50
Replace Decode's font with a Typekit font
<?php
function decode_child_remove_font() {
wp_dequeue_style( 'decode-font-stylesheet' );
}
add_action( 'wp_enqueue_scripts', 'decode_child_remove_font', 20 );
function decode_child_add_typekit() {
echo '<script type="text/javascript" src="//use.typekit.net/XXXXXXX.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>';
# coding: utf-8
''' This script allows you to copy a .py script to the iOS clipboard and then use Open In...
to have that script saved in Pythonista.
This requires both the Workflow and Pythonista apps
and either of the following Workflows:
Save in Pythonista (from Workflow Action Extension) https://workflow.is/workflows/80c7bee7a6c446dc872964600ddd57fd
Open in Pythonista (from Document Picker) https://workflow.is/workflows/e68fdf26479d473b92443a9a69fe176c
@ScottSmith95
ScottSmith95 / Recep_Client.ino
Last active August 18, 2017 22:39
Client for waste receptacle.
// Libraries
#include <ESP8266WiFi.h> // https://github.com/esp8266/Arduino
#include <ESP8266WiFiMulti.h>
#include <PubSubClient.h> // https://github.com/knolleary/pubsubclient/
#include <Wire.h>
#include <LiquidTWI.h> // https://github.com/Stephanie-Maks/Arduino-LiquidTWI
#include <HX711.h> // https://github.com/bogde/HX711
// Some immutable global definitions/constants
#define mqtt_server "mediatedspaces.net" // Class server.
@ScottSmith95
ScottSmith95 / reshape.py
Last active March 4, 2018 00:15
Reformat WDI data extract for Tableau.
# -*- coding: utf-8 -*-
import pandas as pd
in_file_name = 'WDIData.csv' # Make sure this file is in the same folder.
data = pd.read_csv(in_file_name)
data.replace('..', 'Null', inplace=True) # Replace WDI's ".." for missing data with "Null".
data.dropna(axis=1, how='all', inplace=True) # Drop columns with exclusively NA/Null data.
data.drop(data.columns[[1, 3]], axis=1, inplace=True) # Remove country code, series code.