Skip to content

Instantly share code, notes, and snippets.

@iamcarloseperez
iamcarloseperez / README.md
Created April 17, 2017 14:17 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@iamcarloseperez
iamcarloseperez / Git-Workflow
Created March 14, 2016 17:46
Git Team Workflow
Hotfixes should be done on a new branch checked out from the remote master.
Local development should be pushed to that working branch and then a verbal or GitHub pull request should be made for another developer to push it to the master branch and remove the working branch.
Projects should be done on the developer specific branch checked out from the remote master.
Local development should be pushed to that working branch and on significant milestones can be pushed to the dev branch for functional and compatibility testing. It also would not hurt to merge master at that point to merge any hotfixes into the dev branch.
Releases should be done once one or more development projects are complete. The master should be merged into dev one last time. Staging should be checked out from master and then merged with dev. This will cause any conflicts to flow downward instead of upward. Conflicts can be resolved in the dev branch, and pushed to staging for live data testing. Migrations, seeds, synchronizations etc. can
@iamcarloseperez
iamcarloseperez / gist:0cc51d84d266c81c8052
Created October 23, 2015 14:07
Most common email browsers
Here’s a list of some of the most common email clients:
Mobile clients:
Android 2.3 & 4.0
iPhone 5 iOS 6
iPhone 4S iOS 6
iPhone 3GS iOS 5
iPad 2 iOS 6
BlackBerry OS 4 & 5
@iamcarloseperez
iamcarloseperez / is_mobile_user_agent
Created June 16, 2015 15:11
is_mobile_user_agent
/**
* Is this is a mobile client? Can be used by batcache.
* @return array
*/
function is_mobile_user_agent() {
return array(
"mobile_browser" => !in_array( $_SERVER['HTTP_X_UA_DEVICE'], array( 'bot', 'pc' ) ),
"mobile_browser_tablet" => false !== strpos( $_SERVER['HTTP_X_UA_DEVICE'], 'tablet-' ),
"mobile_browser_smartphones" => in_array( $_SERVER['HTTP_X_UA_DEVICE'], array( 'mobile-iphone', 'mobile-smartphone', 'mobile-firefoxos', 'mobile-generic' ) ),
"mobile_browser_android" => false !== strpos( $_SERVER['HTTP_X_UA_DEVICE'], 'android' )
function mobilecheck() {
var check = false;
(function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)
@iamcarloseperez
iamcarloseperez / baseurl
Created April 8, 2015 14:33
Base URL JS
function getBaseUrl(){
pathArray = location.href.split( '/' );
protocol = pathArray[0];
host = pathArray[2];
url = protocol + '//' + host;
return url;
}
@iamcarloseperez
iamcarloseperez / IE Placeholder fix JS
Created March 20, 2015 16:35
IE Placeholder fix JS
var _debug = false;
var _placeholderSupport = function() {
var t = document.createElement("input");
t.type = "text";
return (typeof t.placeholder !== "undefined");
}();
window.onload = function() {
var arrInputs = document.getElementsByTagName("input");
var arrTextareas = document.getElementsByTagName("textarea");
<!-- Favicon -->
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.png" />
//
// Basic print styles
// --------------------------------------------------
// Source: https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css
@media print {
* {
text-shadow: none !important;
color: #000 !important; // Black prints faster: h5bp.com/s
@iamcarloseperez
iamcarloseperez / .bash_profile
Last active August 29, 2015 14:13
.bash_profile Increased workflow all around in the terminal
# Get the Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Custom bash prompt
#
# Includes custom character for the prompt, path, and Git branch name.
#
# Source: kirsle.net/wizards/ps1.html