Hello Le Wagon 👋
This file contains hidden or 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
var english = {}; | |
var americanEnglish = Object.create(english); | |
var britishEnglish = Object.create(english); | |
var define = function(dictionary,word,definition){ | |
dictionary[word] = definition; | |
}; | |
define(english,"house","place to live"); | |
define(english,"tree","big green thing"); |
This file contains hidden or 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
(function(angular) { | |
'use strict'; | |
var app = angular.module('MyApp', []); | |
app.factory('GeolocationSvc', [ | |
'$q', '$window', | |
function($q, $window) { | |
return function() { | |
var deferred = $q.defer(); |
This file contains hidden or 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
vid = document.getElementsByClassName("video-stream html5-main-video")[0]; | |
vid.playbackRate = 3.0; |
This file contains hidden or 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 'oauth2' | |
require 'net/http' | |
require 'uri' | |
API_KEY = 'XXXXXXXXX' #Your app's API key | |
API_SECRET = 'XXXXXXXXXXXXX' #Your app's API secret | |
REDIRECT_URI = 'http://localhost:3000/accept' #Redirect users after authentication to this path | |
#Instantiate your OAuth2 client object | |
def client |
This file contains hidden or 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
function GetCommentsWithOAuth(){ | |
viewModel.comments([]); | |
$.ajax({ url: "/services/comments/oauth", | |
accepts: "application/json", | |
cache: false, | |
statusCode: { | |
200: function(data){ | |
viewModel.comments(data); | |
}, | |
This file contains hidden or 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 'spec_helper' | |
describe "index controller" do | |
describe "GET /users" do | |
context "when there are 0 users" do | |
before do | |
User.delete_all | |
end |
#Simple Authentication with Bcrypt
This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.
The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).
You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault
##Steps
FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)
This file contains hidden or 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
def fizzbuzz(array) | |
result = [] | |
array.each do |i| | |
if i % 15 == 0 | |
result << "FizzBuzz" | |
elsif i % 5 == 0 | |
result << "Buzz" | |
elsif i % 3 == 0 | |
result << "Fizz" | |
else |
NewerOlder