Skip to content

Instantly share code, notes, and snippets.

@zvineyard
zvineyard / gist:2984509
Created June 24, 2012 19:08
CSS: Reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
@zvineyard
zvineyard / gist:3035925
Created July 2, 2012 21:48
JavaScript: Disable Submit Button Upon Form Submission
<form name="form_name" action="" method="post" onsubmit="document.getElementById('btn_submit').disabled = 1;">
<input type="submit" name="btn_submit" value="Submit" class="btn" id="btn_submit" />
</form>
@zvineyard
zvineyard / controller.php
Created July 9, 2012 20:03
CodeIgniter: Add blank value to form_dropdown() and validate
$this->form_validation->set_rules('test', 'Test Field', 'required');
@zvineyard
zvineyard / gist:3084842
Created July 10, 2012 17:19
Android: Get Spinner Value
final Spinner sp = (Spinner) findViewById(R.id.state);
String state = sp.getSelectedItem().toString();
@zvineyard
zvineyard / gist:3106540
Created July 13, 2012 18:34
Android: Simulate Slow Internet Response
try {
Thread.sleep(2000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
@zvineyard
zvineyard / gist:3145677
Created July 19, 2012 17:59
Bash: Send an Email Attachment from Command line with mailx
#!/bin/bash
uuencode /file.csv /file.csv | mail x -r "[email protected]" -s "Subject" [email protected]
@zvineyard
zvineyard / gist:3147253
Created July 19, 2012 22:18
PHP: file_get_contents() HTTP Login
$context = stream_context_create(array(
'http' => array(
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
));
$data = file_get_contents($url, false, $context);
@zvineyard
zvineyard / gist:3361675
Created August 15, 2012 17:12
WordPress: Exclude posts if they are only tagged in a single category (Plugin)
<?php
/*
Plugin Name: Exclude Posts if in Single Category
Description: Exclude posts if they are only tagged in a single category, as defined by the category number. This will show posts in the loop if they are tagged in more than one category.
Version: 1.0
Author: Zac Vineyard
Author URI: http://www.zacvineyard.com
*/
@zvineyard
zvineyard / required_typoscript
Created August 23, 2012 03:35
TypoScript: Get Query String Parameter
categorySelection = TEXT
categorySelection.data = GPvar : cat
@zvineyard
zvineyard / html_form
Created August 30, 2012 15:29
PHP: Upload and Rename File
<form action="" enctype="multipart/form-data" method="post">
<input id="file" name="file" type="file" />
<input id="Submit" name="submit" type="submit" value="Submit" />
</form>