Skip to content

Instantly share code, notes, and snippets.

View scjudd's full-sized avatar

Spencer Judd scjudd

View GitHub Profile
@scjudd
scjudd / .htaccess
Created April 11, 2011 19:20
enable php error logging
# enable PHP error logging
php_flag log_errors on
php_value error_log ./PHP_errors.log
@scjudd
scjudd / redirect.php
Created October 8, 2011 20:15
php redirect
<?php
header("Location: http://www.yoursite.com/new_page.html");
?>
@scjudd
scjudd / gradient.css
Created October 24, 2011 20:42
cross-browser gradient
background: -webkit-gradient(linear, left top, left bottom, from(#254080), to(#1d3366));
background: -moz-linear-gradient(top, #254080,#1d3366);
background: filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#254080', endColorstr='#1d3366');
/* with color stops.. */
background: -webkit-gradient(linear, left top, left bottom, from(#7F87C6), color-stop(20%, #2239A1));
background: -moz-linear-gradient(left top, left bottom, from(#7F87C6), color-stop(20%, #2239A1));
@scjudd
scjudd / macmini4,1_archlinux.md
Created May 3, 2012 18:23
MacMini4,1 Arch Linux Install Guide

Install Arch Linux on a MacMini4,1

  1. Boot into OS X

  2. In Disk Utility, make space for Arch partition

  3. Boot Arch Linux install with 'nomodeset' boot option

  4. Install gptfdisk (provides cgdisk)

@scjudd
scjudd / gist:9a2e0bdbe19bea46bb3c
Created January 6, 2015 15:59
vim scratchpad write to clipboard
:nnoremap ZZ :silent w !xclip<enter>
@scjudd
scjudd / crc32.rs
Last active August 29, 2015 14:21
CRC-32 implementation in Rust
/*
const CRC32_IEEE: u32 = 0xedb88320;
fn crc32_table(poly: u32) -> [u32; 256] {
let mut table = [0u32; 256];
for i in 0..table.len() {
let mut val = i as u32;
for _ in 0..8 {
val = if val&1 == 1 {
(val >> 1) ^ poly
@scjudd
scjudd / Auth.elm
Last active December 1, 2019 16:36
Authentication in Elm
module Auth exposing (User(..), UserInfo, LoginInfo, loginTask)
import HttpBuilder exposing (..)
import Json.Encode as Encode
import Json.Decode as Decode exposing ((:=))
import Task exposing (Task)
type User
= Authenticated UserInfo
@scjudd
scjudd / OptionTree.elm
Created September 28, 2016 21:03
A neat little recursive data structure I'm using in an Elm project.
module OptionTree exposing (..)
type Node meta a
= Tree meta (List (Node meta a))
| OneOf (List a)
| ManyOf (List a)

Keybase proof

I hereby claim:

  • I am scjudd on github.
  • I am scjudd (https://keybase.io/scjudd) on keybase.
  • I have a public key ASC0pMfg2B6QkZug2MJBEev0PVbchBeTaUbGXFu0LuamiQo

To claim this, I am signing this object:

@scjudd
scjudd / add-user.php
Created May 18, 2018 21:53
PHP to create a WordPress admin user
<?php
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
$username = 'spencer';
$password = 'f00b4rb4z!';
$email = '[email protected]';
if (!username_exists($username) && !email_exists($email)) {