Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / photo_lorempixel.txt
Created May 17, 2014 13:55
photo: loremPixel
http://lorempixel.com/g/400/200/people/7/
@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 / 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 / _Javascript: find_item.js
Created June 6, 2014 13:18
_Javascript: find_item
//Underscore
//find item without knowing its position in array
//http://stackoverflow.com/a/11922384/372567
_.find(data.items, function(item) {
return item.id === 2;
});
// Object {id: 2, name: "bar"}
@joelremix
joelremix / jQuery: nextFour.js
Created June 11, 2014 01:32
jQuery: nextFour()
// http://stackoverflow.com/a/18444121/372567
$.fn.nextFour = function (arguments){
return $(this).parent().children().eq(idx + 4-(idx%4)-1); // -1 to correct zero-based index
}
@joelremix
joelremix / jQuery.nextStep.js
Last active August 29, 2015 14:02
jQuery: nextStep
$.fn.nextStep = function(step) {
elem = this.parent().children().eq(this.index() + step -1 -(this.index()%step));
return elem.length ? elem : this.parent().children().last();
};