Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jalcine's full-sized avatar
💭
Decentralize and democratize the Web.

Jacky Alciné jalcine

💭
Decentralize and democratize the Web.
View GitHub Profile
@jalcine
jalcine / 01. Gemfile
Created September 6, 2012 19:22 — forked from schleg/01. Gemfile
Setup for Devise + Omniauth
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'
@jalcine
jalcine / dabblet.css
Created September 18, 2012 19:07 — forked from LeaVerou/dabblet.css
Fixed width, fluid background
/**
* Fixed width, fluid background
*/
body { margin: 0; font-family: Futura, sans-serif; }
h1 { margin-top: 0 }
section {
width: 700px;
@jalcine
jalcine / omniauth.rb
Created October 2, 2012 17:00 — forked from dira/omniauth.rb
OmniAuth strategy for a custom provider
# 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"
@jalcine
jalcine / application.html.erb
Created October 2, 2012 17:01 — forked from rdetert/application.html.erb
How to logout completely from Facebook using Ruby on Rails and Devise + Omniauth. I'm just modifying the Omniauth Railscast http://railscasts.com/episodes/236-omniauth-part-2
<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 %>
@jalcine
jalcine / gist-1.sh
Created October 3, 2012 18:59 — forked from rondale-sc/gist-1.sh
setting-up-a-remote-environment
$ 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
@jalcine
jalcine / gitio
Created October 8, 2012 20:40 — forked from defunkt/gitio
Turn a github.com URL into a git.io URL.
#!/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]
@jalcine
jalcine / AndroidManifext.xml
Created October 11, 2012 07:04 — forked from komamitsu/AndroidManifext.xml
Android Simple web server using NanoHTTPD (http://elonen.iki.fi/code/nanohttpd)
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
@jalcine
jalcine / example.rb
Created October 13, 2012 00:36
Role Hierarchy in Rolify
# 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)
@jalcine
jalcine / namespace.coffee
Created October 25, 2012 16:55
Implementing Namespaces in CoffeeScript and JavaScript
# 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 = "."
@jalcine
jalcine / gist:4243722
Created December 9, 2012 07:14 — forked from fennb/gist:1139016
Chromium speech recognition details
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).