Skip to content

Instantly share code, notes, and snippets.

View acodesmith's full-sized avatar
💯

Adam Smith acodesmith

💯
View GitHub Profile
@acodesmith
acodesmith / data-selectors-example.js
Created June 25, 2012 02:51
jquery data attribute selector
//<span data-order="0"></span>
$("[data-order]");
//<span data-angle="45"></span>
$("[data-angle='45']");
//<span data-order="0" data-weight="5"></span>
$("[data-order][data-weight]");
@acodesmith
acodesmith / How To.js
Created August 31, 2012 03:35
Bon Voyage - jQuery Plugin for Change Detection for Form with Exit beforeunload catch
//simple use, all fields watched
$("form").bonVoyage();
//All possible options
$("form").bonVoyage({
changeAgents: [],
exitMessage: "Leaving the page will cause your changes to be lost.",
ignoreAgents: [],
ignoreButtons: [],
afterChange: function () {},
@acodesmith
acodesmith / connectionForTides
Created September 18, 2012 03:13
Connection to tide data for art chart
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(69,89,21,95); //acodesmith.com
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
<?php
Yii::app()->labScript->registerScriptList(
array(
'/_/js/libs/jquery-ui-1.9.2.custom.min.js',
'/_/js/base.js'=>'function(){}',
),
'function(){ base.init(); }'
);
@acodesmith
acodesmith / example-tooltip-code.html
Last active December 13, 2015 19:08
Simple Javascript Tooltip object using html5 data-ui-tooltip attribute. View Demo: http://codepen.io/acodesmith/pen/ycoDE
<!--This is needed somewhere on the page-->
<!--The JS clones the item, so stack classes as needed-->
<div class="tooltipOuter">
<div class="tooltipInner"></div>
</div>
<!--Example-->
<div class="icon-help" data-ui-tooltip="Example Text in Tooltip. <br />Example Text on Second Line">?</div>
@acodesmith
acodesmith / wpcf7_hook_list.php
Last active June 30, 2019 16:18
Wordpress Contact Form 7 Hook List - Version 3.8
<?php
array(
'wpcf7_admin_after_general_settings',
'wpcf7_admin_after_form',
'wpcf7_admin_after_mail',
'wpcf7_admin_after_mail_2',
'wpcf7_admin_after_messages',
'wpcf7_admin_after_additional_settings',
'wpcf7_admin_footer',
'wpcf7_contact_form',
@acodesmith
acodesmith / hours_dropdown.php
Last active August 29, 2015 14:03
Select Dropdown for Hours in the day. Value is ready for string to time conversion.
<select>
<?php $first = false;
for($t = 12; $t<=23; $t++): ?>
<?php for($m = 0; $m<=45; $m+=15): ?>
<?php $m = $m == 0 ? sprintf("%02s", $m): $m; ?>
<option value="<?php echo ($t == 12 && !$first ? '00' : ($t < 10 ? '0'.$t : $t)).':'.$m.':00'; ?>">
<?php echo $t > 12 ? ($t-12 == 0 ? 12 : $t-12).':'.($m).' PM' : $t.':'.$m.' AM'; ?>
</option>
<?php endfor; ?>
<?php if($t == 12 && !$first){
@acodesmith
acodesmith / jquery-hide-update.js
Created August 20, 2014 13:41
Extend jQuery .show() function to play nice with Twitter Bootstrap hidden class.
/**
* Twitter Bootstrap .hidden class can cause unexpected results
* when interacting with the jQuery .show() function.
*
* Extend the native jQuery show functionality to remove
* the hidden class when .show() is called.
**/
(function($)
{
@acodesmith
acodesmith / shopify-display-search-by-item-type.liquid
Created October 30, 2014 20:15
Shopify Search Results - Display different results based on search item
<!-- PAGE RESULT -->
{% if item.url contains '/pages/' %}
<h1>PAGE</h1>
{% endif %}
<!-- BLOG RESULT -->
{% if item.url contains '/blogs/' %}
<h1>BLOG</h1>
{% endif %}
@acodesmith
acodesmith / yii_pagination_template.scss
Created November 19, 2014 20:53
SCSS Template for stying Yii 1.0 Pagination HTML
//Yii pagination
.pager {
.yiiPager {
li {
&.page {
}