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
import javax.crypto.Cipher; | |
import javax.crypto.Mac; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.security.AlgorithmParameters; | |
import java.security.spec.KeySpec; | |
import javax.crypto.Cipher; | |
import javax.crypto.SecretKey; | |
import javax.crypto.SecretKeyFactory; | |
import javax.crypto.spec.IvParameterSpec; |
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 'rails_helper' | |
RSpec.describe Api::V1::SearchController, :type => :controller do | |
describe "wall search" do | |
before(:each) do | |
Wall.__elasticsearch__.create_index! force: true | |
@tag_ios = Tag.create(name: "ios", score: 2) | |
@tag_ruby = Tag.create(name: "ruby", score: 2) | |
@user1 = FactoryGirl.create(:user) |
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
create user | |
POST api/v1/users | |
input params: | |
user{ | |
mobile_number*: | |
} |
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
# include this module in models where adding record of has_and_belongs_to_many asscociation | |
# changes the updated_at column of included model. | |
module HabtmTouchId | |
extend ActiveSupport::Concern | |
included do | |
after_initialize :create_touch_true_has_and_belongs_to_many | |
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
get book information | |
get '/api/v1/book_info' | |
output: goodreads object | |
get book suggestions | |
get '/api/v1/book_suggestions' | |
output: array of book names | |
get nearby locations |
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
'use strict'; | |
barterApp.directive('autosuggest', function($timeout, $http) { | |
return { | |
restrict: "E", | |
scope: { | |
modelupdate:"=", | |
suggestions:"=", | |
urlsend:"@" | |
}, |
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
'use strict'; | |
barterApp.directive('autosuggest', function($timeout, $http) { | |
return { | |
restrict: "E", | |
scope: { | |
modelupdate:"=", | |
suggestions:"=", | |
urlsend:"@" | |
}, |
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 'spec_helper' | |
# This spec was generated by rspec-rails when you ran the scaffold generator. | |
# It demonstrates how one might use RSpec to specify the controller code that | |
# was generated by Rails when you ran the scaffold generator. | |
# | |
# It assumes that the implementation code is generated by the rails scaffold | |
# generator. If you are using any extension libraries to generate different | |
# controller code, this generated spec may or may not pass. | |
# |
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
// to get the current latitude and longitude from browser | |
// credits https://github.com/arunisrael/angularjs-geolocation | |
'use strict'; | |
angular.module('geolocation',[]).constant('geolocation_msgs', { | |
'errors.location.unsupportedBrowser':'Browser does not support location services', | |
'errors.location.notFound':'Unable to determine your location', | |
}); | |
angular.module('geolocation') |
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
module IsbnCalculator | |
def self.isbn(num) | |
total = multiply_by(num, 1, 3) | |
mod_val = total % 10 | |
mod_val = 10 - mod_val | |
final_val = mod_val == 10 ? 0 : mod_val | |
num.to_s + final_val.to_s | |
end | |
NewerOlder