This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'pg' | |
group :development do | |
gem 'ruby-debug' | |
end | |
gem 'rake', '~> 0.8.7' | |
gem 'devise' | |
gem 'oa-oauth', :require => 'omniauth/oauth' | |
gem 'omniauth' | |
gem 'haml' | |
gem 'dynamic_form' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fixed width, fluid background | |
*/ | |
body { margin: 0; font-family: Futura, sans-serif; } | |
h1 { margin-top: 0 } | |
section { | |
width: 700px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/omniauth.rb | |
module OmniAuth | |
module Strategies | |
# tell OmniAuth to load our strategy | |
autoload :Pixelation, 'lib/pixelation_strategy' | |
end | |
end | |
Rails.application.config.middleware.use OmniAuth::Builder do | |
provider :twitter, "app_name", "secret" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="user_nav"> | |
<% if user_signed_in? %> | |
<img src="<%= user_avatar %>" id="main_avatar"> Signed in as <%= current_user.email %>.<br /> | |
Not you? | |
<% if session[:fb_token].nil? %> | |
<%= link_to "Sign out", destroy_user_session_path %> | |
<% else %> | |
<%= link_to "Sign out", facebook_logout_path %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vi ~/.ssh/config | |
# Add the following information | |
Host rails_blog_db | |
HostName 0.0.0.0 # your remote's public facing IP | |
Port 3122 | |
User jjackson # your username | |
LocalForward 3307 192.168.100.1:3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage: gitio URL [CODE] | |
# | |
# Turns a github.com URL | |
# into a git.io URL | |
# | |
# Copies the git.io URL to your clipboard. | |
url = ARGV[0] | |
code = ARGV[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> | |
<uses-permission android:name="android.permission.INTERNET"></uses-permission> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A lot of times, you might have multiple roles in your User model. | |
# Also, at times, you keep the administrative users and regular users (if you may) in the | |
# same model. This can lead to a few issues when attempting to assign multiple roles | |
# to users. | |
# A potential use-case could be as follows: | |
# file: app/controllers/foo_controller.rb | |
magic_user = User.find_by_foo(:bar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the global namespace as 'root'. | |
root = module?.parent?.exports ? window | |
### | |
@fn namespace | |
Allows you to implement a namespace of objects to the global namespace. | |
### | |
root.namespace = -> | |
separator = "." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int SpeechRecognizer::kAudioSampleRate = 16000; | |
const int SpeechRecognizer::kAudioPacketIntervalMs = 100; | |
const ChannelLayout SpeechRecognizer::kChannelLayout = CHANNEL_LAYOUT_MONO; | |
const int SpeechRecognizer::kNumBitsPerAudioSample = 16; | |
const int SpeechRecognizer::kNoSpeechTimeoutSec = 8; | |
const int SpeechRecognizer::kEndpointerEstimationTimeMs = 300; | |
// ... | |
const char* const kContentTypeSpeex = "audio/x-speex-with-header-byte; rate="; | |
const int kSpeexEncodingQuality = 8; | |
const int kMaxSpeexFrameLength = 110; // (44kbps rate sampled at 32kHz). |