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
# == Schema Information | |
# | |
# Table name: users | |
# | |
# id :integer not null, primary key | |
# email :string | |
# nickname :string | |
# created_at :datetime not null | |
# updated_at :datetime not null | |
# |
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
# OPTION 2 | |
class OnlineUsersController < ApplicationController | |
before_action :require_user | |
before_action :get_users | |
after_action :set_users | |
def show | |
render json: @rails_cached_users | |
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
<script> | |
function gravatarImg(user) { | |
return $('<img src="http://gravatar.com/avatar/' + md5(user.email) + '?s=20">'); | |
} | |
function addUserToList(user, listSel) { | |
var $userEl = $('<li class="list-group-item">'); | |
$userEl.data('id', user.id); | |
$userEl.html(user.nickname); | |
$userEl.prepend(gravatarImg(user)); | |
$(listSel).append($userEl); |
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
<script> | |
function gravatarImg(user) { | |
return $('<img src="http://gravatar.com/avatar/' + md5(user.email) + '?s=20">'); | |
} | |
function addUserToList(user, listSel) { | |
var $userEl = $('<li class="list-group-item">'); | |
$userEl.data('id', user.id); | |
$userEl.html(user.nickname); | |
$userEl.prepend(gravatarImg(user)); | |
$(listSel).append($userEl); |
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
# OPTION 2 | |
class OnlineUsersController < ApplicationController | |
before_action :require_user | |
before_action :get_users | |
after_action :set_users | |
def show | |
render json: @rails_cached_users | |
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
# switch to C-s | |
set -g prefix C-s | |
unbind C-b | |
# use r for reloading | |
unbind r | |
bind r source-file ~/.tmux.conf | |
# Prefer hjkl for moving about the panes | |
bind-key -n C-h select-pane -L |
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
class PusherController < ApplicationController | |
before_action :require_user | |
protect_from_forgery :except => :auth # stop rails CSRF protection for this action | |
def auth | |
if current_user | |
response = Pusher[params[:channel_name]].authenticate(params[:socket_id], { | |
user_id: current_user.id, # => required | |
user_info: { # => optional - for example | |
nickname: current_user.nickname, |
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
class PusherController < ApplicationController | |
before_action :require_user | |
protect_from_forgery :except => :auth # stop rails CSRF protection for this action | |
def auth | |
if current_user | |
response = Pusher[params[:channel_name]].authenticate(params[:socket_id], { | |
user_id: current_user.id, # => required | |
user_info: { # => optional - for example | |
nickname: current_user.nickname, |
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
<script> | |
function gravatarImg(user) { | |
return $('<img src="http://gravatar.com/avatar/' + md5(user.email) + '?s=20">'); | |
} | |
function addUserToList(user, listSel) { | |
var $userEl = $('<li class="list-group-item">'); | |
$userEl.data('id', user.id); | |
$userEl.html(user.nickname); | |
$userEl.prepend(gravatarImg(user)); | |
$(listSel).append($userEl); |
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
require 'twitter' | |
require 'byebug' | |
key = 'tX0F3eIbijsRWKBLeROLZw' | |
secret = '55FrGsSmWI4V15LVFt9eA0AgRve0JZOStnUDYXvP4' | |
token = '31248614-41SUBYfXanhsz04lsnNJvCgbA32830YugCV7fmE4t' | |
token_secret = 'nmZielg0L4FgIhDbnAXRyg7he3MbOH902SDXCfQzQhsjP' | |
def _normalize(results) | |
results.to_h[:statuses].map do |r| |