Skip to content

Instantly share code, notes, and snippets.

View dotspencer's full-sized avatar

Spencer Smith dotspencer

View GitHub Profile
@dotspencer
dotspencer / terminal.txt
Created May 17, 2016 22:26
Change screenshot save location terminal
defaults write com.apple.screencapture location ~/Desktop/Screenshots/;killall SystemUIServer;
@dotspencer
dotspencer / header-empty.php
Last active May 17, 2016 22:59
Custom wordpress php header for loading quickly the page for parsing
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<?php
//if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' );
//wp_head();
?>
@dotspencer
dotspencer / template
Last active May 18, 2016 20:28
EGI project download shortcode. Simple One Tag Shortcode.
<a id="pdf-link" href="{src}" target="_blank">
<span>Download PDF</span>
</a>
<style>
#pdf-link{
background-color: #50575e;
color: #fff;
font-family: 'Open Sans',sans-serif;
font-weight: 400;
@dotspencer
dotspencer / other.txt
Last active May 31, 2016 21:37
Arcgis map animator for Forge map
var map = esri.Map("map_canvas3d");
@dotspencer
dotspencer / advice.txt
Created June 1, 2016 14:53
Adding logo to wordpress theme
Put Code In Function.php
function themeslug_theme_customizer( $wp_customize ) {
$wp_customize->add_section( 'themeslug_logo_section' , array(
'title' => __( 'Logo', 'themeslug' ),
'priority' => 30,
'description' => 'Upload a logo to replace the default site name and description in the header',
) );
$wp_customize->add_setting( 'themeslug_logo' );
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
@dotspencer
dotspencer / test-for-ruby.html
Created June 7, 2016 22:02
test for ruby url loading
<html lang="en-US"><head>
<meta charset="utf-8">
</head><body class="page page-id-4484 page-parent page-child parent-pageid-4478 page-template-default logged-in admin-bar no-customize-support wpb-js-composer js-comp-ver-4.11.2.1 vc_responsive">
<div class="page-container page-boxed">
<div class="preloader"></div>
@dotspencer
dotspencer / site.rb
Created June 7, 2016 22:08
First Ruby tool
require 'sinatra'
require 'open-uri'
def staff
url = "https://egi.utah.edu/about/staff/?mode=quick"
text = URI.parse(url).read
output = ""
text.each_line do |line|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<div class="progress"></div>
<script>
console.log("hi");
$.ajax({
success: function(data){
console.log(data);
// Do stuff with the returned file
@dotspencer
dotspencer / ajax.js
Created June 8, 2016 07:14
ajax request for loading bar
$.ajax({
xhr: function()
{
var xhr = new window.XMLHttpRequest();
//Download progress
xhr.addEventListener("progress", function(evt){
var percentComplete = evt.loaded / evt.total;
//Do something with download progress
console.log("down", percentComplete);
$('progress').attr("value", percentComplete * 100)
<span id="status"></span>
<script>
var url = "/api/research.json";
var num = "{num}";
num = num.toUpperCase();
jQuery.getJSON(url, getStatus);
function getStatus(data){
jQuery("#status").text(data[num].status);