Skip to content

Instantly share code, notes, and snippets.

View jordanandree's full-sized avatar

Jordan Andree jordanandree

View GitHub Profile
@mixin base {
float: left;
margin-left: 2%;
&:first-child {
margin-left: 0;
}
}
@mixin grid_twelve {
@include base;
@jordanandree
jordanandree / Untitled.txt
Created September 13, 2012 12:40
Untitled
<VirtualHost 127.0.0.1:443>
  DocumentRoot "/Users/jordanandree/Rails/ministrycoach/public"
  ServerName ministrycoach.dev
  LogLevel debug
  RackEnv development
  RailsEnv development
  SSLEngine On
  SSLCertificateFile "/private/etc/apache2/server.crt"
require 'rack-rewrite'
DOMAIN = 'www.production-hacks.com' # also works with non-www url such as 'google.com'
# Redirect to the www version of the domain in production
use Rack::Rewrite do
r301 %r{.*}, "http://#{DOMAIN}$&", :if => Proc.new {|rack_env|
rack_env['SERVER_NAME'] != DOMAIN && ENV['RACK_ENV'] == "production"
}
end
@jordanandree
jordanandree / awesome_print_as_default_for_rails_console.rb
Created June 15, 2012 18:03
awesome_print as default for Rails console
## Gemfile
group :development do
gem "awesome_print", :require => "ap"
end
## ~/.irbrc
require "rubygems"
require "ap"
unless IRB.version.include?('DietRB')
@jordanandree
jordanandree / gist:1870738
Created February 20, 2012 19:00
WP Post Count
<?php
function postcount_query( $user_id ) {
// query user post count
return $count;
}
/* in template */
@jordanandree
jordanandree / jQuery Script Source.html
Created April 14, 2011 19:08
A TextMate Snippet that inserts a Google hosted script link with latest version. I have this bound to my Tab trigger of "jquery" for HTML Snippets
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/${0:1.5.2}/jquery.min.js"></script>
<?php
$start = $_GET['page'] == 1 || $_GET['page'] == '' ? 0 : $_GET['page'] * $perpage;
$perpage = 10;
$query = "SELECT * FROM table LIMIT $start, $perpage";
$query = mysql_query($query);
while($row = mysql_fetch_array($query)):
echo '<p>'.$row['id'].' '.$row['data'].'</p>';
endwhile;
<?php
function paginate( $total, $perpage )
{
$current = $_GET['page'] != '' ? $_GET['page'] : 1;
$paginate = '<div>';
$paginate .= $current > 1 ? '<a href="?page='.($current-1).'"> &laquo; Older |</a>' : '';
$paginate .= '<div>';
for($i = 1; $i <= round($total/$perpage); $i++ ){
<?php
function ago($time)
{
$time = strtotime($time);
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10");
$now = time();
$difference = $now - $time;
<?php
function siteroot()
{
global $siteroot;
$siteroot = explode('/', $_SERVER['PHP_SELF']);
$siteroot = 'http://' . $_SERVER['SERVER_NAME'] . '/' . $siteroot[1];
return $siteroot;
}
?>