Skip to content

Instantly share code, notes, and snippets.

View chucktrukk's full-sized avatar

Charlie Madison chucktrukk

View GitHub Profile
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
<?php
class TwigSnippet
{
public function __construct()
{
$this->load_twig();
}
public function index()
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
<?php
/**
* Convert a multi-dimensional array into a stdClass object.
*
* Example:
* $values = array('hello'=>'world');
*
* // Convert the array to an object
* array_to_object($values);
*
@chucktrukk
chucktrukk / USAGE.md
Created October 26, 2010 20:11 — forked from agaoglu/USAGE.md

CRUD requires jquery.deepjson.js to work so it should be included

<script type="text/javascript" src="js/jquery.deepjson.js"></script>

Then you can assign whatever's in crud.json to a variable or you can put crud.json into your evently directory and let couchapp push it to your application.

Simplest way to use it is

/**
* Copyright (c) 2010 Maxim Vasiliev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
/**
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
* You can set up various options to control how the system will work
* Copyright (c) Denis Howlett <denish@isocra.com>
* Licensed like jQuery, see http://docs.jquery.com/License.
*
* Configuration options:
*
* onDragStyle
* This is the style that is assigned to the row during drag. There are limitations to the styles that can be
@chucktrukk
chucktrukk / modx_revolution_youtube.chunk
Created October 27, 2010 02:55
Use via: [[$Chunk? &video_id=`bip_sEKAsTU`]]
<object width="480" height="385">
<param name="movie" value="http://www.youtube.com/v/[[+video_id]]?fs=1&amp;hl=en_US"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/[[+video_id]]?fs=1&amp;hl=en_US"
type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"
width="480" height="385">
</embed>
</object>
@chucktrukk
chucktrukk / foxycart_dependent_products.js
Created October 27, 2010 08:08
from at fc_adam with the Foxycart Team at http://pastie.org/1192630
<script type="text/javascript">
//Instructions at: http://forum.foxycart.com/comments.php?DiscussionID=1572&page=1#Comment_25071
jQuery(document).ready(function($){
// [["parentCode"], ["dependantCode1","dependantCode2"]]
var productPairs = [
[["sub"], ["subfee"]],
[["tee"], ["freetee","freeteefee"]]
];
<script type="text/javascript" charset="utf-8">
jQuery.noConflict();
gc_validation = function() {
var errors = 0; // Let's set a variable called 'errors', and set the value to 0.
if (!jQuery('#first-name').val()) {
errors ++;
jQuery('#first-name').addClass('error');
}else{
jQuery('#first-name').removeClass('error');
}