Skip to content

Instantly share code, notes, and snippets.

// Usage:
// Create a dynamic textfield with linkage name helloworld_txt and give it an initial value of '{{hello}} {{world}}!'
// add the function substitute below to a static class or put it somewhere in your project
// call it by passing the textfield name first and an object of key values to replace second
Helpers.substitute(helloworld_txt, {hello: 'It', world: 'Works' });
// run the file, the textfield should now say "It Works!"
bash-3.2$ brew install -v ffmpeg
Also installing dependencies: libvorbis, theora, libvpx, xvid
==> Downloading http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
File already downloaded and cached to /Users/john/Library/Caches/Homebrew
/usr/bin/tar xf /Users/john/Library/Caches/Homebrew/libvorbis-1.3.2.tar.bz2
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/libvorbis/1.3.2
./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/libvorbis/1.3.2
checking build system type... i386-apple-darwin10.7.4
checking host system type... i386-apple-darwin10.7.4
checking target system type... i386-apple-darwin10.7.4
@johnrees
johnrees / hamlhtml5boilerplate.html.haml
Created November 15, 2011 10:32 — forked from neiled/hamlhtml5boilerplate.html.haml
Rails 3.1.1 barebones HAML HTML5Boilerplate
!!!
/[if lt IE 7] <html class="no-js ie6 oldie" lang="en">
/[if IE 7] <html class="no-js ie7 oldie" lang="en">
/[if IE 8] <html class="no-js ie8 oldie" lang="en">
<!--[if (gt IE 8)]><html lang="en" class="no-js"><![endif]-->
%head
%meta{charset: "utf-8"}
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
%title 'Rails 3.1.1 barebones HTML5Boilerplate'
@johnrees
johnrees / gist:1670449
Created January 24, 2012 14:32
Remote IP on Heroku
def remote_ip
if forwarded = request.env["HTTP_X_FORWARDED_FOR"]
forwarded.split(",").first
elsif addr = request.env["REMOTE_ADDR"]
addr
end
end
@johnrees
johnrees / _ubuntu_steps.sh
Last active November 29, 2021 01:42
Standard Rails 5.* setup for Ubuntu 14.04 LTS
# As root user
sudo su
# Update the OS
sudo apt-get update -y
# Add this to ~/.bashrc to remove timezone warnings
echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc
source ~/.bashrc
@johnrees
johnrees / gist:2000975
Created March 8, 2012 13:27
Linode vs Rackspace
Linode 512MB / 20GB / 200GB Transfer = 12.69
Rackspace / 7.30 + 1.46 = 8.76
Rackspace / 14.06 + 2.81 = 16.87
Linode 12.69 * 2 = 25.38 inc VAT
Rackspace 14.06 + 7.30 = 21.36 ex VAT = 25.62 inc VAT
<!DOCTYPE html>
<html>
<head>
<title>Source</title>
<meta charset="UTF-8">
<script type="text/javascript">
history.replaceState(null, null, String.fromCharCode(8238) + 'lmth.ecruos');
</script>
</head>
<body>
@johnrees
johnrees / opacity_mixin.css.scss
Created May 2, 2012 11:26
SASS/SCSS Internet Explorer Compatible Opacity Mixin
@mixin opacity($alpha) {
// IE 8
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=$alpha*100)";
// IE 5-7
filter: alpha(opacity=$alpha*100);
// Real Browsers
-webkit-opacity: $alpha;
-moz-opacity: $alpha;
-khtml-opacity: $alpha;
opacity: $alpha;
@johnrees
johnrees / bitsushi.zsh.theme
Created May 8, 2012 09:51
Bitsushi's OHMYZSH Theme
PROMPT='%{$fg_bold[yellow]%}⚡%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@johnrees
johnrees / application.html.erb
Created June 12, 2012 20:59
Google AJAX Jquery CDN for Rails 3 App
<!--
1. REMOVE //= require jquery IN application.js
2. ADD config.assets.precompile += %w( jquery.js ) IN production.rb
-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write("<%= j javascript_include_tag "jquery" %>")</script>
<%= javascript_include_tag "application" %>