Skip to content

Instantly share code, notes, and snippets.

View jeremejazz's full-sized avatar

Jereme Causing jeremejazz

View GitHub Profile
@jeremejazz
jeremejazz / inputfiltersearch.js
Created March 11, 2013 05:22
Simple text search filter. Searches through a list of items on keypress of a textbox. #filtersearch is the ID for the html input field. #list is the ID of the <ul>
$('input#filtersearch').bind('keyup change', function () {
if ($(this).val().trim().length != 0) {
$('#list li').show().hide().each(function () {
if ($(this).is(':icontains(' + $('input#filtersearch').val() + ')'))
$(this).show();
});
}
else {
$('#list li').show().hide().each(function () {
@jeremejazz
jeremejazz / mssql_insert_id.php
Created March 12, 2013 09:06
MSSQL Last Autoincrement ID
<?php
function mssql_insert_id() {
$id = 0;
$res = mssql_query("SELECT @@identity AS id");
if ($row = mssql_fetch_array($res)) {
$id = $row["id"];
}
return $id;
}
@jeremejazz
jeremejazz / postwidget.html
Created March 12, 2013 09:11
po.st Social Bookmark Widget Integration
<!--
Just add this inside <div class='post-footer'>
-->
<!-- Po.st start-->
<div class="sharebtn">
<div class="pw-widget pw_copypaste_true pw-size-medium pw_counter_true">
<a class="pw-button-facebook"></a>
<a class="pw-button-twitter"></a>
@jeremejazz
jeremejazz / checkdatatype.php
Created March 12, 2013 09:12
Snippet for checking if string is an integer or float
<?php
$number = '3.8';
if ((int) $number == $number) {
//it is an integer
}else{
//it is a float
@jeremejazz
jeremejazz / JErrors.php
Created March 19, 2013 05:11
Class for Error Logging
<?php
class JErrors{
private $filename = '';
/*
@param filename
*/
function __construct($file) {
@jeremejazz
jeremejazz / pointLocation.php
Created March 22, 2013 08:48
Determines whether coordinates is within polygon or not. Also tells if point is along boundary. See example at bottom of code
<?php
class pointLocation {
var $pointOnVertex = true; // Check if the point sits exactly on one of the vertices
function pointLocation() {
}
function pointInPolygon($point, $polygon, $pointOnVertex = true) {
@jeremejazz
jeremejazz / ConvertHoursMins.php
Created June 3, 2013 05:31
used to convert Hours:Mins to minutes and the other way around
<?php
function convertMinsToHours($time, $format = '%d:%s') {
settype($time, 'integer');
if ($time < 0 || $time >= 1440) {
return;
}
$hours = floor($time/60);
$minutes = $time%60;
if ($minutes < 10) {
@jeremejazz
jeremejazz / index.html
Created July 11, 2013 05:24
A CodePen by Jereme Causing. JQuery UI Slide Panel Toggle - Jquery UI Sliding panel
<button id="switch">Toggle</button><br/>
<div id="panel" style="height:400px;width:400px;background-image:url('http://farm4.static.flickr.com/3550/3367798587_c24c797f0f.jpg');color:white;font-weight:bold;">This is a demonstration</div>
@jeremejazz
jeremejazz / functions.php
Created July 13, 2013 09:41
Play Audio in WordPress Excerpt
<?php
/*Add this code to
functions.php
From: http://premium.wpmudev.org/forums/topic/audio-preview-in-product-excerpt#post-280140
*/
function add_audio_to_excerpt( $excerpt ){
@jeremejazz
jeremejazz / addslashes.js
Created September 30, 2013 02:19
Addslashes function from PHP.js
function addslashes (str) {
// http://kevin.vanzonneveld.net
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Ates Goral (http://magnetiq.com)
// + improved by: marrtins
// + improved by: Nate
// + improved by: Onno Marsman
// + input by: Denny Wardhana
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Oskar Larsson Högfeldt (http://oskar-lh.name/)