Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Morris danieljohnmorris

  • London, UK
View GitHub Profile
@danieljohnmorris
danieljohnmorris / fb_pixels.html
Last active Aug 29, 2015
FB Conversion Pixel Ads
View fb_pixels.html
<!-- Facebook Conversion Code for Signup success - Fans of Alumni - Website Clicks -->
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
View rspec_rails_cheetsheet.rb
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
View rspec_cheatsheet_controller_spec.rb
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do
View rspec_rails_cheetsheet.rb
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
page.should render_template(:index)
#Redirecting
page.should redirect_to(movies_path)
@danieljohnmorris
danieljohnmorris / pg_gem_fix
Created Feb 23, 2015
pg gem yosemite / mavericks
View pg_gem_fix
# WORKSSSS!
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
# DOESNT INCLUDE INTO BUNDLE
#gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
@danieljohnmorris
danieljohnmorris / ajax.js
Last active Aug 29, 2015
Ajax apply jquery
View ajax.js
$.ajax({
type: "POST",
url: "https://www.sofarsounds.com/competitions/jessie-j/apply",
data: { _method:'POST' },
success: function(msg) {
console.log("Request complete");
}
});
View email.html
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top" style="color:#333; font-family:Arial; font-size:14px; line-height:150%; text-align:left;">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
@danieljohnmorris
danieljohnmorris / email.html
Created Sep 16, 2014
desk replies - new theme
View email.html
{% assign emails = case.emails %}
{% assign threadlength = emails.size|minus:1 %}
{% for email in emails reversed %}
{% if forloop.first %}
{{email.new_html}}
{% if email.agent %}
{% if email.agent.signature %}
View .bash_profile
# This goes in user root dir, ie ~
# So you can just call
alias deploy=./deploy.sh
alias deploy_ci=./deploy_ci.sh
alias deploy_live=./deploy_live.sh
View phonegap_commands.sh
# create new project
phonegap create my-app
# requires...
# - android sdk
# - brew install ant
# - adding tools and platform-tools to path
#PATH=$PATH:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/tools # android command
#PATH=$PATH:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/platform-tools # adb command
You can’t perform that action at this time.