Skip to content

Instantly share code, notes, and snippets.

@j-mcnally
j-mcnally / pg.php
Created August 18, 2011 01:13
CodeIgniter Permalink Routing
<?php
//would be controllers/pg.php
class pg extends Controller {
var $pgItem;
var $parentPage;
function pg() {
//do some constructor related stuff here
}
function permalink($segments) {
@j-mcnally
j-mcnally / Php.sh
Created January 13, 2016 18:45
Grabbing a heroku app's URL on deployment. Useful for review apps that need the URL at runtime for mailers or wordpress.
#!/bin/bash
APP_URL=`php -r "print json_decode('$RECEIVE_DATA', 1)[\"push_metadata\"][\"app_info\"][\"web_url\"];"`
echo "----> APP URL DETECTED AS: $APP_URL"
echo $APP_URL > appurl.txt
@j-mcnally
j-mcnally / deploy.js
Created August 16, 2015 05:44
Using ember-deploy-s3 with Google Cloud Storage
module.exports = {
production: {
buildEnv: 'production', // Override the environment passed to the ember asset build. Defaults to 'production'
store: {
type: "S3",
accessKeyId: "XXX",
secretAccessKey: "XXX",
bucket: "bucket-index",
acl: 'public-read', //optional, e.g. 'public-read', if ACL is not configured, it is not sent
endpoint: "storage.googleapis.com",
@j-mcnally
j-mcnally / gist:8511557
Created January 19, 2014 22:00
Stubbing charge creation in stripe
@charges = []
Stripe::Charge.stub(:create) { |hash| @charges << hash }
@j-mcnally
j-mcnally / gist:8329642
Created January 9, 2014 05:06
When your presentation has a public demo where users can post messages.... this is what happens.
Sup dawg
I heard you like ember
Hey
Larry rules
Sup
heyo
Seems to work pretty well
This works
mkay
Yo yo yo
"scripts": {
"postdeploy": "bundle exec rake db:migrate; bundle exec rake db:seed"
}
@j-mcnally
j-mcnally / Loadmoreable.rb
Last active December 30, 2015 18:19
Loadmoreable
module ProMotion
module Table
module LoadmoreClassMethods
def load_moreable=(val)
@load_moreable = val
end
def load_moreable
@load_moreable || false
end
def load_more_options=(val)
@j-mcnally
j-mcnally / cringe.coffee
Created November 9, 2013 00:50
I bet things like this make eric bryn cringe
channelCallback: (msg) ->
msgs = jQuery.parseJSON(msg.payload)
newMessages = new Ember.RecordArray()
newMessages.set('modelClass', App.Message)
newMessages.load(App.Message, msgs)
newMessages.set('isLoaded', true)
@set('messages', newMessages)
@j-mcnally
j-mcnally / UINavigationBar+DarkTint.h
Created October 15, 2013 06:19
Swizzle Color Transparent
//
// UINavigationBar+DarkTint.h
//
// Created by Justin McNally on 10/15/13.
//
//
#import <UIKit/UIKit.h>
@interface UINavigationBar (DarkTint)
@j-mcnally
j-mcnally / gist:6871312
Created October 7, 2013 17:01
Rspec Sublime Build System
{
"cmd": ["/bin/bash", "-l", "-c", "echo 'Running RSPEC for $file'; source .rvmrc && bundle exec rspec $file"],
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "source.ruby",
"variants": [
{ "cmd": ["/bin/bash", "-l", "-c", "echo 'Running entire RSPEC Suite'; source .rvmrc && bundle exec rspec"],
"name": "Run",
"working_dir": "${project_path:${folder:${file_path}}}"
}
]