This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ajax submit example */ | |
$(function(){ | |
// example 1 (only POST) | |
$('#form-id').submit(function(e){ | |
e.preventDefault(); | |
var frm = this; | |
var ajax_opts = {}; | |
ajax_opts.url = $(frm).attr('action'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class MY_Loader extends CI_Loader { | |
/** | |
* Database Loader [modified to synchronize mysql database timezone] | |
* @author Sujeet <sujeetkv90@gmail.com> | |
* | |
* @param mixed $params Database configuration options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jsonPrettify | |
* | |
* @param {String|Object} json Json object or string | |
* @param {Boolean} preformatted Preformatted for html | |
* @param {Boolean} colored Colored for preformatted | |
* | |
* @return {String} | |
*/ | |
var jsonPrettify = function (json, preformatted, colored) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.stickyScroll = function () { | |
var $this = this; | |
var scrollbar = $('<div id="fixed-scrollbar"><div></div></div>').appendTo($(document.body)); | |
scrollbar.hide().css({ | |
overflowX: 'auto', | |
width: '100%', | |
position: 'fixed', | |
bottom: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Card class | |
*/ | |
class Card | |
{ | |
private $deck = null; | |
private $pos = null; | |
private $suit = ''; | |
private $rank = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* using connection pool (recommended) */ | |
var mysql = require('mysql'); | |
var log = require('./mylogger'); | |
var local_context = this; | |
var SimpleQueryException = function (message) { | |
this.name = 'SimpleQueryException'; | |
this.message = message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import json | |
OP_STACK = list() | |
ELEM_STACK = list() | |
COMP_STACK = list() | |
OP_MONGO_MAP = dict({ | |
'AND': '$and', | |
'OR': '$or', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('form').on('submit', function (evt) { | |
evt.preventDefault(); | |
var form = this; | |
var $form = $(this); | |
$.ajax({ | |
url: $form.attr('action'), | |
type: 'post', | |
data: new FormData(form), | |
cache: false, | |
processData: false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery.deparam() | |
* @author Sujeet Kumar <sujeetkv90@gmail.com> https://github.com/sujeetkv | |
* | |
* @param string queryString (params string) | |
* @param boolean coerce (force type conversion) | |
*/ | |
(function ($) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* (?!_) can not start with seperator | |
* (?!.*?_$) can not start with seperator | |
* [a-z] first letter should be alphabet | |
* [a-z_]+ other slug string | |
* | |
* @see https://unix.stackexchange.com/questions/78481/regex-to-match-identifiers-without-double | |
*/ | |
var regex = /^(?!_)(?!.*?_$)[a-z][a-z_]+$/; |
OlderNewer