Skip to content

Instantly share code, notes, and snippets.

View nickrouty's full-sized avatar

Nick Routsong nickrouty

  • Routy Development LLC
  • Arizona
View GitHub Profile
@nickrouty
nickrouty / gist:52269b159bd283710830
Last active August 29, 2015 14:02
Install PHP IMAP Extension for OSX Mavericks
#!/bin/bash
BUILDDIR=/tmp/php_imap_mavericks
mkdir "$BUILDDIR"
echo " "
echo "= FETCHING AND INSTALLING IMAP"
echo " "
cd "$BUILDDIR"
wget -c ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
rm -rf imap-2007f
/*
* From css-tricks.com
* http://css-tricks.com/snippets/css/media-queries-for-standard-devices/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
<?php
/**
* ACF Layout
* @version 1.0 | November 12th 2013
* @author Beau Charman | http://twitter.com/beaucharman
* @link https://gist.github.com/beaucharman/7181406
* @license MIT license
*
* Logical layout automation for Advanced Custom Fields and it's Flexible Content Field add on.
@nickrouty
nickrouty / appname-Info.plist
Created September 29, 2015 16:46
Updating your Apache Cordova app to work with iOS 9 comes with some confusion. We found that we weren't able to make remote requests to API end points that we needed to. To ensure this would work we needed to add the following code to the platforms/ios/[AppName]/appname-Info.plist file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>ReplaceWithYourDomanName.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
@nickrouty
nickrouty / install-plugin-whitelist.txt
Created September 29, 2015 16:54
Force installation of Cordova Plugin Whitelist in order to work with Cordova iOS Platform 3.9.1
cordova plugin add cordova-plugin-whitelist@1.0.0
@nickrouty
nickrouty / config.xml
Created September 29, 2015 17:03
Example config.xml and index.html meta tag definition for Cordova app to handle Content Security Policy. Learn more: https://github.com/apache/cordova-plugin-whitelist#content-security-policy
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
@nickrouty
nickrouty / Send HTML Email in PHP
Created May 6, 2013 16:35
Send HTML Email in PHP
$to = 'mail@example.com';
$from = 'you@example.com';
$reply_to = 'you@example.com';
$subject = 'Website Change Reqest';
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($reply_to) . "\r\n";
$headers .= "CC: " . strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
@nickrouty
nickrouty / gist:5580174
Created May 14, 2013 22:26
Starting up with Marionette
$(function(){
window.AFA = {};
AFA.Models = {};
AFA.Collections = {};
AFA.Views = {};
AFA.Models.User = Backbone.Model.extend({
initialize: function(){
var devices = new AFA.Collections.Devices(this.get('devices'));
@nickrouty
nickrouty / palindrom-test.php
Created March 8, 2017 18:34
Palindrome or not?
<?php
$string = "madam";
$array = str_split($string);
$reverse_array = array_reverse( $array, true );
$new_string = implode('', $reverse_array);
echo "<pre>";
var_dump($array, $reverse_array);
echo ( $string === $new_string) ? "Yes, {$string} is a palindrome." : "No, {$string} is not a palindrome.";
class ExampleSingleton {
private $properties = array();
private static $instance;
private __construct(){}
public getInstance()
{
if (empty(self::$instance)) {