Skip to content

Instantly share code, notes, and snippets.

View jeffstephens's full-sized avatar

Jeff Stephens jeffstephens

View GitHub Profile
@jeffstephens
jeffstephens / fixed.css
Created September 4, 2012 22:02
A great fixed-width layout!
/* Great fixed layout! It looks pixel-perfect
* anywhere but doesn't scale well.
*/
#topbar{
width: 785px;
padding: 5px;
text-align: right;
}
@jeffstephens
jeffstephens / responsive.css
Created September 4, 2012 22:04
A great responsive layout that flows nicely to any size screen
/* A responsive layout that should
* adjust nicely to any screen size!
*/
#topbar{
width: 80%;
margin: auto;
padding: 1%;
text-align: right;
}
@jeffstephens
jeffstephens / jQuery-textarea.html
Created May 25, 2013 00:32
Quick jQuery demo for setting textarea contents and using html() in general
<!doctype html>
<head>
<title>Textarea Default Values</title>
<link type="text/css" rel="stylesheet" href="bootstrap/css/bootstrap.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript">
function setDynamic(id){
var text = prompt("Enter your desired text.");
$('#' + id).html(text);
@jeffstephens
jeffstephens / crudeparse.php
Last active August 29, 2015 14:09
A really messy way to quickly parse an HTML document.
// HTML structure
<html>
<body>
<table id="transactions">
<tr><td>Nov 8 2014</td><td>Chipotle</td><td>6.83</td></tr>
<tr><td>Nov 9 2014</td><td>Wok Eat</td><td>9.13</td></tr>
<tr><td>Nov 10 2014</td><td>Hazel's Beverage World</td><td>321.54</td></tr>
</table>
</body>
</html>
@jeffstephens
jeffstephens / setURIParameter.js
Created September 10, 2015 21:14
A handy Javascript function to add/update/remove a GET parameter from a URI.
// add or update a GET variable in a URL
function setURIParameter(uri, key, value) {
if (uri.indexOf("&amp;") >= 0) {
console.log("Warning: setURIParameter expects an unencoded URI. This looks like an encoded URI (found &amp;).");
}
// just append the key-value pair to the end of the URI if this parameter isn't present
if (uri.indexOf("?" + key) === -1 && uri.indexOf("&" + key) === -1) {
// support key deletion via a recursive call (so don't add it back)
if (value.length === 0) {
<?php
class MachineDescription {
public $name, $type;
public function __construct($name, $type) {
$this->name = $name;
$this->type = $type;
}
}
<!doctype html>
<html lang="en">
<head>
<title>Welcome to my sweet page!</title>
<link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
text-align: center;
background: #333;
color: #CCC;
@jeffstephens
jeffstephens / snippet.js
Last active July 15, 2016 20:31
Modified "tumblr welcome page" script to hide a custom interstitial rather than redirecting to a custom page.
/**
* Tumblr Welcome Page
*
* This JS snippet should be installed in your Tumblr theme.
* Every new browser session, this will hide the custom interstitial
* if the user has already seen it once.
*/
$(document).ready( function() {
@jeffstephens
jeffstephens / title-font-for-sam.html
Last active July 21, 2016 03:42
Style overrides for Tumblr landing page
<!-- paste this code into the <head> section of your blog
the !important means it will override any other settings -->
<style type="text/css">
/* page title ("Sam Herschel Wein") */
.cover-title {
font-family: 'Dancing Script' !important;
}
/* page description ("Poet. Loudmouth. Hugger.") */
.cover-desc {

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: