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
Benchmark.ips do |x| | |
x.report('parallel') do | |
Parallel.map_with_index(data, in_processes: processes) do |import, i| | |
processor.import [import.merge(id: i)] | |
result = processor.render(type, id: i) | |
result = result.first if type == :bibliography | |
result | |
end | |
end | |
x.report('without') do |
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
def logout | |
content_tag :li do | |
content_tag :a, rel: 'nofollow', href: logout_path, 'data-method' => :delete do | |
concat(content_tag :span, image_tag('icons/icon-log-out', class: 'img-responsive', alt: ''), class: 'icon') | |
concat(content_tag :span, 'Log Out', class: 'title') | |
end | |
end | |
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
irb(main):002:0> u = User.find(2492) | |
User Load (2.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2492 LIMIT 1 | |
User Load (2.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2492 LIMIT 1 | |
=> #<User id: 2492, login: nil, email: "sebastian.lenk+cm303@googlemail.com", crypted_password: "b2a864829cc2cbd63d264c8f9c881295c85d4fe4", salt: "f08a417c0331469b8c9d3972de8b00e8955e89ee", created_at: "2017-03-27 12:52:26", updated_at: "2017-03-27 13:15:51", remember_token: nil, remember_token_expires_at: nil, zipcode: nil, firstname: "", lastname: "", user_type: "", age: nil, password_reset_code: nil, admin: nil, donated_on: nil, age_verification: nil, privacy_policy: nil, disabled: nil, password_digest: nil, subscribed_at: "2017-03-27 12:55:56", chegg_id: "21ffff98-bf0c-4649-a31b-71463af71cc4", chegg_access_token: "HLphgIRLD3XZMakFkC8KlkoylXhY", chegg_refresh_token: nil> | |
irb(main):003:0> c = Braintree::Customer.find(u.account.braintree_customer_id) | |
Account Load (1.9ms) SELECT `accounts`.* FROM `ac |
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 BraintreePayment | |
class << self | |
def cancel_plan! | |
end | |
def charge! | |
end | |
def fetch_customer! |
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
bash-3.2$ docker build --pull -t chegg/jb . | |
Sending build context to Docker daemon 1.115 MB | |
Step 1/12 : FROM ruby:2.2.5-alpine | |
2.2.5-alpine: Pulling from library/ruby | |
3690ec4760f9: Pull complete | |
6353f0aa4196: Pull complete | |
11cea0b89b81: Pull complete | |
2fe1fa3442ae: Pull complete | |
a07dedcb22ec: Pull complete |
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
def update_email!(new_email:, old_password:) | |
return true if new_email == @user.email | |
client = CheggAuthService.client_from_environment | |
@user.email = new_email | |
begin | |
if @user.valid? | |
client.change_email(access_token: @user.chegg_access_token, new_email: new_email) | |
@user.save | |
else |
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 'thread' | |
threads = (0...5).map do | |
Thread.new | |
ActiveRecord::Base.connection_pool.with_connection do | |
user = User.find(1) | |
user.update_attributes(admin: true) | |
end | |
end | |
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
{"data":{"pubonline":{"title":"Wikipedia","day":"","month":"","year":"","inst":"Wikimedia Foundation","dayaccessed":"21","monthaccessed":"november","yearaccessed":"2016","url":"https://en.wikipedia.org/wiki/Abraham_lincoln"},"website":{"title":"Abraham lincoln"},"contributors":[],"autocite":{"url":"https://en.wikipedia.org/wiki/Abraham_lincoln"},"pubtype":{"main":"pubonline"},"source":"website"},"display":{"page_title":"Wikipedia"}} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" media="all" href="/assets/bibme.css" /> | |
<link rel="stylesheet" media="screen" href="//fonts.googleapis.com/css?family=Asap:400,700" /> | |
<link rel="stylesheet" media="screen" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" /> | |
<script src="http://media.studybreakmedia.com/staging/sbm-bundle-v2.6.0_schema-v3.0.x.js"></script> | |
<script> |
NewerOlder