Skip to content

Instantly share code, notes, and snippets.

var App;
function App() {
this.panda = "sad";
}
module.exports = App;
@patricksimpson
patricksimpson / scripts.coffee
Last active December 23, 2015 23:28
The CoffeeScript example source code.
# Assignment:
number = 42
opposite = true
# Conditions:
number = -42 if opposite
# Functions:
square = (x) -> x * x
@patricksimpson
patricksimpson / deploy.sh
Created October 2, 2013 14:18
Lightweight github deployment. Requires (Expect) on your client box. You must setup the remote server first, by creating the remote path, and setting up a github clone of your repository. You can either setup an install script on the server, or run your install commands from this file.
#!/usr/bin/expect
set password "thepassword"
set login "yourlogin"
set host "199.199.199.199"
set remotepath "/var/www/html/yoursite.com"
spawn ssh $host -l $login
expect "$login@$host's password: "
send "$password\n"
@patricksimpson
patricksimpson / gist:8457610
Created January 16, 2014 16:09
Rewrite Rule
RewriteRule ^/test /test?var=val [QSA]
sudo xcodebuild -license
xcode-select --install # There will be a GUI prompt
sudo cpan SVN::Core # use the "sudo" method when prompted
# Then add this to your ~/.profile:
# export PATH=/Library/Developer/CommandLineTools/usr/bin:$PATH
# Then probably:
brew reinstall git
brew reinstall subversion
@patricksimpson
patricksimpson / functions.sh
Created February 6, 2014 02:04
Some helper functions for npm modules, grunt, grunt contrib.
# npm install and save dev
function ni() {
npm install --save-dev "$@"
}
# npm install grunt package, and save dev.
function gi() {
npm install --save-dev grunt-"$@"
}
# npm install grunt contrib package, and save dev.
<VirtualHost *:80>
ServerAdmin patrick@heysparkbox.com
DocumentRoot ""
ServerName server.dev
<Directory "">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.html index.php
@patricksimpson
patricksimpson / dynamic.php
Last active August 29, 2015 13:56
The example script for dynamic functions in the updated super-cache (1.4)
<?php
/* NEW DYNAMIC FUNCTION */
define( 'OAM_DYNAMIC_YOUR_FUNCTION', 'CACHE_OAM_YOUR_TAG');
function OAM_your_function_filter( &$cachedata = 0) {
if (defined('OAM_DYNAMIC_YOUR_FUNCTION_TEXT'))
return str_replace( OAM_DYNAMIC_YOUR_FUNCTION, OAM_DYNAMIC_YOUR_FUNCTION_TEXT, $cachedata);
$text = OAM_your_function_filter_output();
if ( $cachedata === 0 )
define('OAM_DYNAMIC_YOUR_FUNCTION_TEXT', $text);
@patricksimpson
patricksimpson / dynamic-template.php
Created March 2, 2014 18:01
The 2nd part of the updated dynamic content blocks.
<?php if (OAM_isCaching('OAM_your_function_filter')){
OAM_your_function_filter();
?>
CACHE_OAM_YOUR_TAG
<?php } else {
echo OAM_your_function_filter_output();
}
?>
@patricksimpson
patricksimpson / .htaccess
Created March 12, 2014 15:51
An example of longer expires.
<ifmodule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 second"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType image/gif "access plus 518400 seconds"
ExpiresByType image/jpeg "access plus 518400 seconds"
ExpiresByType image/png "access plus 518400 seconds"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 216000
seconds"