Skip to content

Instantly share code, notes, and snippets.

task :test do
array = [
"lorem",
"ipsum",
"dolor"
]
array.each do |word|
# http://stackoverflow.com/questions/2504445/spawn-a-background-process-in-ruby
# bad
hashed_books["ItemSearchResponse"]["Items"]["Item"].each do |item|
books = OpenStruct.new
books.name = item["ItemAttributes"]["Title"]
books.url = item["DetailPageURL"]
books.image_url = item["LargeImage"]["URL"]
@books << book
end

Seems Half Pipe is looking for my assets in public/assets/styles and public/assets/scripts, which naturally 404s.

Here's what I did:

  • Installed grunt-cli:

      npm install grunt-cli -g
    
  • Added Half-Pipe to my Gemfile:

% env
!::=::\
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\anon\AppData\Roaming
COMMONPROGRAMFILES=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=MACBOOK
COMSPEC=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
@frankie-loves-jesus
frankie-loves-jesus / 1 - Info.md
Last active August 29, 2015 14:01
Random Ruby cron schedule with Whenever and ruby-thread

Randomized Ruby cron schedule with Whenever

Cool pg_search stats

Attempt to display some cool search stats using pg_search. About 759,000,000 results (0.29 seconds), Searches related to <keyword>: <keyword> <keyword> <keyword> etc.

Hi,

Here's a gist which sketches a very basic implementation. There are some shortcomings, but I hope it's clear how to tweak and extend it to fit your purposes. I'm not sure how to get ActiveRecord to return the duration of a single query, which is why I set the @duration to the "realtime" benchmark of the whole time spent in ActiveRecord. You may be able to do something hacky with ActiveSupport::Notifications, but I opted for an easy-to-understand solution over a technically precise solution.

P.S. the Case Commons Development Google Group is quite helpful for all things pg_search, and I'm sure they have more intelligent things to say than I! >

@frankie-loves-jesus
frankie-loves-jesus / openbsd55.md
Last active August 29, 2015 14:01
OpenBSD 5.5 and rvm

http://www.openbsd.org/55.html

dev% curl -L https://get.rvm.io | bash -s stable --ruby
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0     11      0  0:00:16  0:00:15  0:00:01    45
100 20511  100 20511    0     0    713      0  0:00:28  0:00:28 --:--:-- 14323
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
{
"ItemSearchResponse" => {
"xmlns" => "http://webservices.amazon.com/AWSECommerceService/2011-08-01", "OperationRequest" => {
"HTTPHeaders" => {
"Header" => {
"Name" => "UserAgent", "Value" => "Jeff/1.0.1 (Language=Ruby; dev.my.domain)"
}
}, "RequestId" => "4ba63efd-0ff2-4b71-9713-eced654944fd", "Arguments" => {
"Argument" => [{
"Name" => "Service", "Value" => "AWSECommerceService"