Skip to content

Instantly share code, notes, and snippets.

View cjwd-snippets's full-sized avatar

cjwd-snippets

View GitHub Profile
@cjwd-snippets
cjwd-snippets / gist:4074384
Created November 14, 2012 19:58
HTML: Form with top labels
<form action="/">
<fieldset>
<label for="name">Name</label>
<input type="text" id="name" class="form-text" />
<p class="form-help">This is help text under the form field.</p>
</fieldset>
<fieldset>
<label for="email">Email</label>
<input type="email" id="email" class="form-text" />
@cjwd-snippets
cjwd-snippets / gist:4074392
Created November 14, 2012 19:58
CSS: Form with top labels
form fieldset {
margin: 0 0 20px 0;
font-size: 14px;
}
form fieldset.form-actions {
margin: 0;
}
form fieldset label {
display: block;
margin: 0 0 5px 0;
@cjwd-snippets
cjwd-snippets / gist:4074407
Created November 14, 2012 20:00
jQuery: Enable placeholder attribute in old browsers
$(function(){
var d = "placeholder" in document.createElement("input");
if (!d){
$("input[placeholder]").each(function(){
$(this).val(element.attr("placeholder")).addClass('placeholder');
}).bind('focus',function(){
if ($(this).val() == element.attr('placeholder')){
$(this).val('').removeClass('placeholder');
}
}).bind('blur',function(){
@cjwd-snippets
cjwd-snippets / snippet.xml
Created November 17, 2012 17:56 — forked from JeffreyWay/snippet.xml
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@cjwd-snippets
cjwd-snippets / gist:5359249
Last active December 16, 2015 01:59
clearfix
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
@cjwd-snippets
cjwd-snippets / WP Plugin Comment
Last active December 17, 2015 17:58
Wordpress Plugin Comment
<?php
/*
Plugin Name:
Plugin URI:
Description: My Plugin
Version:1.0
Author: Chinara James
Author: http://chinarajames.com
*/
?>
@cjwd-snippets
cjwd-snippets / HTML starter
Last active December 18, 2015 00:58
HTML starter
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
@cjwd-snippets
cjwd-snippets / Placeholder Fallback
Created July 15, 2013 16:42
Simple input placeholder fallback
<input id="q" autofocus>
<script>
if (!("autofocus" in document.createElement("input"))) {
document.getElementById("q").focus();
}
</script>
@cjwd-snippets
cjwd-snippets / Empty Table
Last active December 21, 2015 23:19
Bootstrap Empty Table Markup
<table class="table table-bordered">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@cjwd-snippets
cjwd-snippets / piklist-custom-post-type.php
Last active September 29, 2017 17:27
Piklist Custom Post Type
add_filter('piklist_post_types', 'register_custom_post_types');
/**
* Register the custom post types
*
* @since 1.0.0
*/
public function register_custom_post_types($post_types) {
$post_types['cw_project'] = [
'labels' => piklist('post_type_labels', 'Projects'),