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
| import pprint | |
| import re | |
| import sys | |
| import urllib | |
| import urllib2 | |
| # pip install pyquery | |
| try: | |
| from pyquery import PyQuery as pq | |
| except: |
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
| $ sslmate buy *.cameralends.com | |
| If you don't have an account yet, visit https://sslmate.com/signup | |
| Enter your SSLMate username: cameralends | |
| Enter your SSLMate password: ************** | |
| Authenticating... Done. | |
| Tip: if you don't want to have to type your password every time, you can run 'sslmate link' to link this system with your account. | |
| Generating private key... Done. | |
| Generating CSR... Done. | |
| Submitting order... |
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 insert_many | |
| 1000.times { SeoRank.create! } | |
| end | |
| start = Time.now | |
| ActiveRecord::Base.transaction { insert_many } | |
| puts "N transactions: #{ Time.now - start }" | |
| start = Time.now | |
| ActiveRecord::Base.transaction { insert_many } |
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 pay_lender!(token = nil) | |
| fail unless lender.stripe_recipient_id || token | |
| recipient = lender.stripe_recipient_id || | |
| create_recipient!(token, lender.name).id | |
| Stripe::Transfer.create( | |
| amount: (lender_profit * 100).round, | |
| currency: "usd", | |
| recipient: lender.stripe_recipient_id, | |
| statement_description: "CameraLends Lending" | |
| ) |
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
| $ ffmpeg -f image2 -r 24 -pattern_type glob -i '*.JPG' -vf "scale=trunc(iw/4)*2:trunc(ih/4)*2" -c:v libx264 time-lapse.mp4 | |
| ffmpeg version 2.2.4 Copyright (c) 2000-2014 the FFmpeg developers | |
| built on Jun 23 2014 16:31:17 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) | |
| configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid | |
| libavutil 52. 66.100 / 52. 66.100 | |
| libavcodec 55. 52.102 / 55. 52.102 | |
| libavformat 55. 33.100 / 55. 33.100 | |
| libavdevice 55. 10.100 / 55. 10.100 | |
| libavfilter 4. 2.100 / 4. 2.100 | |
| libavresample 1. 2. 0 / 1. 2. 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 'gmail' | |
| label = 'transactional/payment' | |
| Gmail.new(username, password) do |gmail| | |
| puts "Emails that match label '#{ label }'" | |
| lender_profit = 0 | |
| gmail.mailbox(label).emails.each do |email| | |
| message = email.message | |
| next if message.subject =~ /^Re: / | |
| next if message.subject =~ /^Fwd: / |
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
| { | |
| data: { | |
| results: [ | |
| { | |
| camname: "EOS 5D Mark III", | |
| cammake: "Canon", | |
| camexifid: "CANON EOS 5D MARK III", | |
| lensname: "Canon EF 24-105mm f/4 L IS USM", | |
| author_name: null, | |
| author_url: null, |
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 example_pictures_for(gear) | |
| pp = PixelPeeper.new | |
| if gear.pp_lens_id.present? | |
| pp.examples(lens_id: gear.pp_lens_id) | |
| elsif gear.pp_camera_id.present? | |
| pp.examples(camera_id: gear.pp_camera_id) | |
| else | |
| [] | |
| end.take(8) | |
| end |
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 'httparty' | |
| class PixelPeeper | |
| include HTTParty | |
| base_uri 'www.pixel-peeper.com' | |
| default_timeout 1 # hard timeout after 1 second | |
| def api_key | |
| ENV['PIXELPEEPER_API_KEY'] | |
| end |
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 'httparty' | |
| class PixelPeeper | |
| include HTTParty | |
| base_uri 'www.pixel-peeper.com' | |
| def api_key | |
| ENV['PIXELPEEPER_API_KEY'] | |
| end |