Skip to content

Instantly share code, notes, and snippets.

View rjfranco's full-sized avatar
🙂
Either working or playing video games

Ramiro Jr. Franco rjfranco

🙂
Either working or playing video games
View GitHub Profile
@rjfranco
rjfranco / homebrew-postgresql-update-steps.md
Last active March 4, 2017 23:38
Upgrade steps for homebrew postgresql database

Upgrading a PostgreSQL Database

When using homebrew, on OSX

  • launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist (old way)
  • brew services stop postgresql (new way)
  • mv /usr/local/var/postgres /usr/local/var/postgres.old
  • initdb /usr/local/var/postgres -E utf8
  • pg_upgrade -b /usr/local/Cellar/postgresql/9.3.5_1/bin -B /usr/local/Cellar/postgresql/9.4.0/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres
  • ./delete_old_cluster.sh (automatically generated in current directory)
  • rm delete_old_cluster.sh
@rjfranco
rjfranco / wierd.js
Last active February 26, 2019 21:58
Javascript is Wierd.
[] + []
// returns an empty string, ''
[] + [0]
// returns a string, '0'
[0] + [0]
// returns a string, '00'
[0,0] + [0]
@rjfranco
rjfranco / error-stack-trace
Created April 2, 2013 23:13
Array Controller error when specifying serializer on route in order to use transitionToRoute
Uncaught TypeError: Object #<Object> has no method 'addArrayObserver' ember.js:11360
Ember.ArrayProxy.Ember.Object.extend._setupArrangedContent ember.js:11360
Ember.ArrayProxy.Ember.Object.extend._arrangedContentDidChange ember.js:11350
sendEvent ember.js:2428
notifyObservers ember.js:2763
Ember.propertyDidChange ember.js:2630
iterDeps ember.js:2667
dependentKeysDidChange ember.js:2651
Ember.propertyDidChange ember.js:2628
set ember.js:2850
@rjfranco
rjfranco / emberjs-transition.coffee
Last active December 15, 2015 16:29
EmberJS transitionToRoute error.
App.Router.map ->
@route 'index', {path: "/#{short_name}"}
@route 'customList', {path: "/#{short_name}/custom-list/:list_name"}
@route 'multiLevelList', {path: "/#{short_name}/multi-level-list/:list_name/:list_level"}
App.EventController = Em.ObjectController.extend
goTo: (navbar_icon) ->
@transitionToRoute navbar_icon.route, navbar_icon.context
# Sample passed navbar_icon
@rjfranco
rjfranco / hidden-text.scss
Created March 10, 2013 00:23
Proper image hack for css
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@rjfranco
rjfranco / gau-gac-alias.sh
Created August 21, 2012 16:10
ZSHRC add git unchanged / changed aliases.
echo "alias gau='git update-index --assume-unchanged'" >> ~/.zshrc && echo "alias gac='git update-index --no-assume-unchanged'" >> ~/.zshrc
@rjfranco
rjfranco / nginx.conf
Created July 27, 2012 17:47
Sample Configuration for Nginx
server {
listen 80;
server_name tedera.com;
root /var/www/tedera/current/public;
passenger_enabled on;
if ($host = 'www.tedera.com') {
rewrite ^/(.*)$ http://tedera.com/$1 permanent;
}
}
@rjfranco
rjfranco / meal_plan.rb
Created July 26, 2012 19:25
MealPlan Class
class MealPlan < ActiveRecord::Base
attr_accessible :active
has_many :meals
before_save :check_for_active_plan
def check_for_active_plan
if MealPlan.active.nil?
if self.active == false
flash[:alert] = 'You must have at least one active Meal Plan'
@rjfranco
rjfranco / rubyracer-error
Created July 26, 2012 05:43
Error Compiling Ruby Racer in OSX 10.8 / Ruby 1.9.3-p194
Fetching: libv8-3.3.10.4.gem (100%)
Building native extensions. This could take a while...
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/ramiro/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for main() in -lobjc... yes
creating Makefile
@rjfranco
rjfranco / pop-stripe.md
Created July 19, 2012 04:59
Rainbow stripe mixin with SCSS + Compass

Rainbow stripe mixin with SCSS + Compass

I'm trying to make a horizontal rainbow stripe background gradient mixin, but I feel like this is way too verbose. How can it be better?

Goals:

  1. Use variables for colors so they can be swapped out for different colors.
  2. The widths are hard coded for 8 colors. Can it be done smarter where it adjusts to the number of colors you add? Or is that asking too much?
  3. The colors are defined twice for the color starts and stops. Can this be done better?
  4. Right now I define the colors as variables at the top level, then pass them in the mixin. Should they instead be created inside the mixin and then colors are brought in as arguments? Or does that matter?