Skip to content

Instantly share code, notes, and snippets.

View optikalefx's full-sized avatar

Sean Clark optikalefx

View GitHub Profile
@optikalefx
optikalefx / script.js
Created September 26, 2012 04:55
Gist Tabs by Sean Clark
// each gist
$(".gist").each(function() {
// reference to this
var $gist = $(this);
// hide all gist file but the first one
$gist.find(".gist-file:not(:first)").hide();
// create the gist header
function downloadFile($fileLocation,$fileName,$maxSpeed = 100,$doStream = false){
if (connection_status()!=0) return(false);
$path_parts = pathinfo($fileLocation);
$extension = strtolower($path_parts["extension"]);
$path_parts["basename"] = $fileName;
/* List of File Types */
<?php
// catch form submit
if(isset($_POST['submit'])) {
// make it safe for mysql
$name = mysql_real_escape_string($_POST['name']);
$password = mysql_real_escape_string($_POST['password']);
// if we found a match
function downloadFile($fileLocation,$fileName,$maxSpeed = 100,$doStream = false){
if (connection_status()!=0) return(false);
$path_parts = pathinfo($fileLocation);
$extension = strtolower($path_parts["extension"]);
$path_parts["basename"] = $fileName;
@optikalefx
optikalefx / ajax.php
Last active October 12, 2015 06:58
Open JS Grid Linking
<?php
// require our class
require_once("grid.php");
// load our grid with a table
$grid = new Grid("tutorials", array(
"joins"=>array(
"LEFT JOIN categories ON categories.CategoryID = tutorials.CategoryID"
),
"fields"=>array(
@optikalefx
optikalefx / ajax.php
Created October 31, 2012 16:40
Open JS Grid Drop Downs
<?php
// require our class
require_once("grid.php");
// load our grid with a table
$grid = new Grid("tutorials", array(
"save"=>true,
"select" => 'selectFunction'
));
@optikalefx
optikalefx / script.js
Created October 31, 2012 16:59
Row Numbering, Row Checkboxes
var $grid = $(".demo6").grid({
rowNumbers: true,
checkboxes:true
});
$grid.on("rowCheck",function(e, $checkbox, rowData) {
// using the checkbox, seeing if were checked or unchecked
var checked = $checkbox[0].checked ? "checked" : "unchecked";
// calling the notify method on the grid plugin
@optikalefx
optikalefx / demo5.html
Last active October 12, 2015 06:58
Custom Cell Types and Custom Callbacks
<table class="grid demo5" action="ajax.php">
<tr>
<th col="Price" type="money">Price</th>
<th col="TutorialID" type="hashBang">TutorialID</th>
</tr>
</table>
@optikalefx
optikalefx / script.js
Created October 31, 2012 18:17
Adding Columns / Buttons
<script>
$(function(){
var $grid = $(".demo6").grid({
editing: true
}).on("loadComplete",function(e) {
// the add column
$(this).grid("addColumn","Add",{
width: 60,
insertAt: "end", // index | column | "end" | "start"
window.Root.Collection = _array.define({
has: function(value) {
if ( this.indexOf(value) !== -1 ) {
return true;
} else {
return false;
}
},
add: function(value) {
if ( !this.has(value) ) {