Skip to content

Instantly share code, notes, and snippets.

View jakebellacera's full-sized avatar

Jake Bellacera jakebellacera

View GitHub Profile
<script type="text/javascript">
// Redirect to a page
(function () {
window.location = 'http://google.com';
})();
</script>
/*----------------------------------------------------------
RGB to HEX Converter
----------------------------------------------------------*/
var hex = {
temp: {
chars: '0123456789ABCDEF',
partA: '',
partB: '',
output: ''
},
@jakebellacera
jakebellacera / jquery.parallaxhelper.js
Created May 16, 2012 21:47
A basic parallax helper for Scrollorama
/**
* Parallax helper using Scrollorama
*/
var parallax = function () {
var parallax = this,
$scrollorama,
cachedWindowHeight = window.innerHeight();
this.init = function () {
// load scrollorama
self.metrics = function () {
var tempUpdater = setInterval(function () {
$.get('/php/thermistor.php', function (data) {
$('#temp').html(data + '<span>&deg; F</span>');
});
}, 2000);
}
{
"color_scheme": "Packages/User/colour-schemes/Tomorrow Night.tmTheme",
"font_face": "Consolas",
"font_size": 14,
"draw_white_space": "all",
"ignored_packages": ["Vintage"],
"rulers": [80],
"theme": "Soda Dark.sublime-theme"
}
@jakebellacera
jakebellacera / dock.sh
Created August 22, 2012 18:13
Make the dock show up fast when using autohide
defaults write com.apple.Dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.5
killall Dock
@jakebellacera
jakebellacera / mamp-mysql2-rbenv.md
Created August 22, 2012 20:29
Instructions on how to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

Let's say you're a web developer who happens to work with both MAMP and Ruby when building different types of websites. Let's say you also like to keep your MySQL stuff in one place and don't like having to juggle both a local MySQL install as well as a MAMP MySQL install. Well, you can indeed connect your ruby apps to MAMP's MySQL. Here's a tutorial on how to do it.

Important! Before you do anything, download and install MAMP. MAMP Pro will work as well. At the time of this writing, MAMP 2.1.1 is the latest.

First, install Ruby via rbenv

  1. Install homebrew
  2. Install rbenv: brew install rbenv, follow any instructions homebrew gives you after the installation is complete.
@jakebellacera
jakebellacera / sucky.haml
Created August 26, 2012 05:57
This is when HAML can suck
#somediv
%p
This is my content for the div!
= link_to "Some Link", "http://jakebellacera.com"
is my favorite website in the world!
%p
This is another paragraph. If you need help finding stuff, click
= link_to "here", "#"
. If you don't need to go there, you can click
= link_to "me", "#"
@jakebellacera
jakebellacera / jquery.css3animate.js
Created September 5, 2012 20:12
jQuery.css with jQuery.animate fallbacks. Useful for CSS3 animations.
//= require modernizr
// Helper for performing css3 or jquery animations
;(function( window, $, undefined ){
'use strict';
$.fn.css3animate = function (rules, duration, easing, callback) {
var $this = $(this);
if (Modernizr.csstransitions) {
@jakebellacera
jakebellacera / install.sh
Created September 7, 2012 00:32
run this as curl -L <url> | bash
#!/usr/bin/env bash
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev nginx
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar xzvf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194
./configure --prefix=/usr/local
make