Skip to content

Instantly share code, notes, and snippets.

View fmtarif's full-sized avatar

Faisal Muhammad fmtarif

View GitHub Profile
@fmtarif
fmtarif / mysqlcmd.sh
Last active June 22, 2018 06:17
#mysql #cli MySQL command line commands
#export
#export directly to a diff server
#ref: https://twitter.com/fideloper/status/1009781805581553665/photo/1
mysqldump --single-transaction some_db \
| gzip | ssh user@host "cat > some_db.sql.gz"
#export directly to S3
mysqldump --single-transaction some_db | gzip | aws s3 cp - s3://some-bucket/some_db.sql.gz
<?php
/*
Description: A simple class based on a tutorial at WP.Tuts that creates an page with metaboxes.
Author: Stephen Harris
Author URI: http://www.stephenharris.info
*/
/* Copyright 2011 Stephen Harris (contact@stephenharris.info)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@fmtarif
fmtarif / .htaccess
Created September 27, 2013 10:49 — forked from vinaydotblog/.htaccess
AddType text/cache-manifest manifest
RewriteEngine On
# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/
RewriteBase /
# Do not enable rewriting for files or directories that exist
@fmtarif
fmtarif / .htaccess
Created September 27, 2013 10:53 — forked from lavoiesl/.htaccess
# LESS compiler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} ^(.*)\.css
RewriteCond %1.less -f
RewriteRule ^(.*)\.css lessphp/less.php?f=$1.less
@fmtarif
fmtarif / gist:6743098
Created September 28, 2013 15:23
browser class through JS
//add browser classes to body
var browser = [];
if (/mozilla/.test(navigator.userAgent.toLowerCase()) && !/webkit /.test(navigator.userAgent.toLowerCase()))
browser.push('mozila');
if (/webkit/.test(navigator.userAgent.toLowerCase()))
browser.push('webkit');
if (/opera/.test(navigator.userAgent.toLowerCase()))
browser.push('opera');
if (/safari/.test(navigator.userAgent.toLowerCase()))
browser.push('safari');
@fmtarif
fmtarif / youtube playlist embed code
Last active December 24, 2015 09:39
youtube embed codes playlist - with couple of parameters to auto start, light theme, etc thumb images
<iframe width="640" height="390"
src="//www.youtube.com/embed/NT2vjByVhyw?list=PL4D692517BFF6D817&theme=light&autoplay=1&rel=0&modestbranding=1"
frameborder="0" >
</iframe>
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
/**
Uploading files
Taken from: http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in-plugins/
INSTRUCTIONS:
In the page you wish to use this script you'll need to enque the media scripts and this script.
Then create a input box and a button with NOTHING in between.. with the class 'upload_image_button'
<?php
wp_enqueue_media();
/*nice box shadow for buttons/inputs*/
box-shadow: 0px 0px 1px 5px rgba(0,0,0,0.12);
/*sutle box shadow four sides for panels/tiles*/
-moz-box-shadow: 0 0 8px -5px #606060;
-webkit-box-shadow: 0 0 8px -5px #606060;
box-shadow: 0 0 8px -5px #606060;*/
/* big drop shadow two sides for panels */
box-shadow: 3px 3px 5px 2px #CCCCCC
/***** Selector Hacks ******/
/*****
http://www.paulirish.com/2009/browser-specific-css-hacks/
******/
/* IE6 and below */
* html #uno { color: red }
/* IE7 */
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);