Skip to content

Instantly share code, notes, and snippets.

View radarseven's full-sized avatar

Michael Reiner radarseven

  • York, PA
View GitHub Profile

Media Temple Capistrano Deployment Recipe

With GitHub

See comments in the files for explanation. This works flawlessly for me on MediaTemple + Git(Hub).

NOTE: this assumes that the application name on the grid container and the application name in GitHub are the same.

To use:

On the Server

(function($) {
$.fn.konami = function(callback, code) {
if(code == undefined) code = "38,38,40,40,37,39,37,39,66,65";
var kkeys=new Array();
return this.each(function() {
$(this).keydown(function(e){
kkeys.push( e.keyCode );
if ( kkeys.toString().indexOf( code ) >= 0 ){
$(this).unbind('keydown', arguments.callee);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cross-browser kerning-pairs & ligatures</title>
<style>
body { font-family: sans-serif; background: rgba(30, 10, 0, 0.05); color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; }
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px; -webkit-transition: background 1s ease; }
a:hover { background: rgba(0, 220, 220, 0.2); }
p { line-height: 1.5; padding: 0px 1em 0em 0em; }
<?php
// Dynamic paths for cross-server compatibility
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = "system";
$images_folder = "images";
$images_path = $base_path . "/" . $images_folder;
@radarseven
radarseven / git_archive
Created February 11, 2013 14:56
Git archiving - Add this to your .bash_profile
# Git archiving
function git_archive()
{
git archive --output="$1".zip HEAD $(git diff --name-only "$1" "$2" --stat)
}
@radarseven
radarseven / gist:9553815
Created March 14, 2014 18:30
Craft 1.4 - Import Matrix block to entry.
<?php
/**
* Matrix Block
*/
if( isset($importEntry->post) )
{
$matrixData = array(
'pageContent' => array(
'type' => 'text',
'enabled' => true,
@radarseven
radarseven / keybase.md
Created July 17, 2014 01:21
Keybase.io

Keybase proof

I hereby claim:

  • I am radarseven on github.
  • I am mreiner (https://keybase.io/mreiner) on keybase.
  • I have a public key whose fingerprint is 8D8A 0216 8BC3 F316 AAB4 B282 64B1 1734 D629 3694

To claim this, I am signing this object:

@radarseven
radarseven / businessingBiz.js
Created August 17, 2015 19:22
How To Get Ahead in Business
var businessingBiz = (function () {
var layerMeIn = function () {
var theSignOfTheBeast = 666;
var theShrugPerson = '\u00AF'+'\\_('+'\u30C4'+')_/'+'\u00AF';
for (var i = 0; i <= theSignOfTheBeast; i++) {
alert(theShrugPerson);
}
};
@radarseven
radarseven / craft-template-with-querystring-filters.twig
Last active January 11, 2017 16:44
Craft 2.x - Filtering entries in a single Twig template
{# How to handle querystring filters in a single Twig template. #}
{# Baseline entries/categories criteria. #}
{# Set any criteria here that will be relevant regardless of filters. #}
{# Section name can be array if you need to fetch from more than one section. #}
{% set criteria = {
section: ['sectionName'],
order: 'postDate desc',
limit: 9
} %}
@radarseven
radarseven / structureHelper.twig
Last active March 15, 2023 20:03
Craft CMS - Twig macro for finding position of entry in Structure section.
{# Get the position of an entry in a Structure section. #}
{% macro getEntryPosition(entry, level) %}
{% spaceless %}
{% if entry is defined and entry|length and entry.section is defined and entry.section.type == 'structure' %}
{% set siblingIds = craft.entries.section(entry.section.handle).level(level|default(2)).ids() %}
{% set position = null %}
{% for siblingId in siblingIds %}
{% if position is null %}
{% set position = siblingId == entry.id ? loop.index : null %}
{% endif %}