Skip to content

Instantly share code, notes, and snippets.

@joelremix
joelremix / contains.js
Created June 3, 2014 17:30
JS: inArray function
function contains(a, obj)
{
var i = a.length;
while (i--)
{
if (a[i] === obj)
{
return true;
}
}
@joelremix
joelremix / git_basic_commands.txt
Created May 27, 2014 15:37
GIT: basic commands
//push branch to origin
git push -u origin mynewfeature
//create and checkout branch named hotfix
git checkout -b hotfix
//merge
git checkout master
git merge hotfix
@joelremix
joelremix / photo_lorempixel.txt
Created May 17, 2014 13:55
photo: loremPixel
http://lorempixel.com/g/400/200/people/7/
@joelremix
joelremix / jQuery_ajaxSetup.js
Created May 16, 2014 10:16
jQuery: ajaxSetup
$.ajaxSetup(
{
error: function(jqXHR, exception)
{
if (jqXHR.status === 0)
{
alert('Not connect.\n Verify Network.');
}
else if (jqXHR.status === 404)
{
@joelremix
joelremix / momentum-scrolling-ios.css
Created April 29, 2014 03:22
CSS: momentum scroll ios
.module {
overflow-y: scroll; /* has to be scroll, not auto */
-webkit-overflow-scrolling: touch;
}
@joelremix
joelremix / responsive.css
Created April 1, 2014 11:50
CSS: responsive queries
/*iPhone < 4:*/
@media screen and (device-aspect-ratio: 2/3) {}
/*iPhone 4 retina */
@media screen and (device-aspect-ratio: 2/3) and (-webkit-min-device-pixel-ratio: 2) {}
/*iPhone 5:*/
@media screen and (device-aspect-ratio: 40/71) {}
/*iPad:*/
@joelremix
joelremix / html5.html
Created April 1, 2014 11:48
HTML: html5 template
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes">
<link rel="stylesheet" type="text/css" href="normalize.css">
<link rel="stylesheet" type="text/css" href="main.css">
</head>
@joelremix
joelremix / get_string_between.php
Last active November 29, 2021 17:23
PHP: get_string_between()
function get_string_between($string, $start, $end){
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}
$fullstring = "this is my [tag]dog[/tag]";
@joelremix
joelremix / backup_table
Created March 21, 2014 02:32
MySQL: backup_tables
CREATE TABLE wp_posts_BAK LIKE wp_posts ;
INSERT wp_posts_BAK SELECT * FROM wp_posts;
CREATE TABLE wp_postmeta_BAK LIKE wp_postmeta ;
INSERT wp_postmeta_BAK SELECT * FROM wp_postmeta;
@joelremix
joelremix / prevent_scrolling
Created June 15, 2013 17:52
JS: prevent scrolling
document.body.addEventListener('touchmove', function(event) {
event.preventDefault();
}, false);
// http://www.html5rocks.com/en/mobile/touch/