I hereby claim:
- I am drewtempelmeyer on github.
- I am tempelmeyer (https://keybase.io/tempelmeyer) on keybase.
- I have a public key whose fingerprint is 9176 E981 1EF3 D6EB 4A79 9C89 3CCE 543A E3CC B9BC
To claim this, I am signing this object:
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" |
# This benchmark assumes we're consistently looking for the last | |
# item in the array. | |
# | |
# If you want to use a random number, use i = rand(1..20) in both | |
# reports. | |
require "benchmark" | |
n = 500_000 | |
arr = (1..20).map { |i| { id: i } } |
class Funko | |
# Add these scopes to your model | |
scope :for_user, ->(user) { where(user: user) } | |
scope :for_category, ->(category) { joins(:category).where(categories: { name: category }) } | |
scope :newest, -> { order(created_at: :desc) } | |
end | |
def index | |
category = params[:category] | |
@funkos = Funko.newest |
#!/bin/bash | |
# Set up variables | |
run_server=true | |
show_help=false | |
# Set up the server command | |
if [ -f 'ember-cli-build.js' ]; then | |
SERVER_CMD='ember server --proxy http://localhost:3000' | |
elif [ -f 'bin/rails' ]; then |
I hereby claim:
To claim this, I am signing this object:
/** | |
* Balanced.js Validators | |
* | |
* jQuery Validation methods for use with Balanced.js | |
*/ | |
;(function($) { | |
"use strict"; | |
/** |
DEFAULT_FILE_STORAGE = 'cumulus.storage.CloudFilesStorage' | |
THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE |
from django.conf import settings | |
from django.http import HttpResponseRedirect | |
class SSLRequiredMixin(object): | |
def dispatch(self, request, *args, **kwargs): | |
if settings.DEBUG is False and request.is_secure() is False: | |
host = request.get_host() | |
url = 'https://%s%s' % (host, request.get_full_path()) | |
return HttpResponseRedirect(url) | |
return super(SSLRequiredMixin, self).dispatch(request, *args,**kwargs) |
User.limit(1).first # User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`deleted_at` IS NULL LIMIT 1 | |
User.first # User Load (0.6ms) SELECT `users`.* FROM `users` WHERE `users`.`deleted_at` IS NULL LIMIT 1 | |
User.first.class.to_s # => User | |
User.limit(1).all.class.to_s # => Array |
result = @transaction.lookup[:lookup_response][:lookup_result] | |
cart_item_response = result[:cart_items_response][:cart_item_response] | |
total_tax = cart_item_response.map { |item| item[:tax_amount].to_f }.inject(:+) |