Skip to content

Instantly share code, notes, and snippets.

@travisvalentine
travisvalentine / steps.md
Last active June 10, 2023 19:00
Setup Facebook app to test authentication locally (aka, setting up App Domain)

Note: I had issues with setting up my Facebook app so authentication would work. I'd receive the error at the bottom, and it took me a while to figure out what was wrong

Here are the steps I took:

  • Go to http://developers.facebook.com/, create, and setup your app
  • When inside the dashboard, click "Settings"
  • Click "Add Platform"
  • Choose website (for authentication via the web app)
  • Add http://localhost:3000/ as "Site URL" (and "Mobile URL" if necessary)
  • Add localhost to "App Domains" above
@travisvalentine
travisvalentine / ruby_100.rb
Created January 31, 2014 02:38
PersonalChef and Butler
class PersonalChef
def make_toast
puts "Making your toast!"
end
def make_milkshake
puts "Making your milkshake!"
end
# def make_toast(color)
@travisvalentine
travisvalentine / sum_multiples.rb
Last active January 4, 2016 07:29
One method, two languages
# RUBY METHOD
# -----------------------------------
def sum_multiples(min, max)
n = (max - 1) / n
sum = n * (n+1) / 2 * min
end
@travisvalentine
travisvalentine / fibonacci.scala
Last active January 3, 2016 22:59
Scala Project Euler #2
import scala.collection.mutable.MutableList
var a = MutableList(1,2)
var upto = 4000000
while(a(a.size - 2) + a(a.size - 1) < upto) {
a += (a(a.size - 2) + a(a.size - 1))
}
var sum = 0
a.foreach(x => { if(x % 2 == 0) sum += x } )
@travisvalentine
travisvalentine / error.log
Created May 10, 2013 03:01
Error after running rake clean and NSZombieEnabled=YES rake
1.9.3 Test [master] $ NSZombieEnabled=YES rake
Build ./build/iPhoneSimulator-6.1-Development
Build vendor/CrittercismSDK
Build vendor/Pods
Build settings from command line:
ARCHS = i386
CONFIGURATION_BUILD_DIR = .build
IPHONEOS_DEPLOYMENT_TARGET = 6.1
SDKROOT = iphonesimulator6.1
@travisvalentine
travisvalentine / Gemfile
Created May 10, 2013 02:44
rubymotion error on launch
source 'https://rubygems.org'
gem 'bubble-wrap', '~> 1.3.0.osx'
gem 'motion-testflight'
gem 'cocoapods'
gem 'motion-cocoapods'
gem 'sugarcube'
gem 'geomotion'
gem 'formotion'
export PATH=${PATH}:/usr/local/sbin
export ARCHFLAGS='-arch x86_64' 
# memcached
alias mcd='memcached -d -l 127.0.0.1 -p 11211'
alias mck='killall memcached'
alias mcst='ps ax | grep memcached | grep -v grep'
# RVM

Install

brew install logrotate

add to .bash_profile

export PATH=${PATH}:/usr/local/sbin

restart terminal just to check the logrotate command returns something

logrotate -?

make logrotate.d directory inside of /etc/ and add new config file

@travisvalentine
travisvalentine / dashboard_show.js
Created May 15, 2012 19:57
Refactored JavaScript for feed_engine dashboard#show.html.slim
$(function() {
$("#posts").show();
$("#privacy").hide();
$("#services").hide();
$("#subscriptions").hide();
$("#account").hide();
show_div_for_error();
show_sidebar_for_error();
});
function show_div_for_error() {
@travisvalentine
travisvalentine / silent_assets.rb
Created April 30, 2012 15:14 — forked from mattyoho/silent_assets.rb
Silence assets in Rails
# Place in config/initializers/
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
call_without_quiet_assets(env).tap do
Rails.logger.level = previous_level
end