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
defmodule Snug.Repo do | |
alias Snug.Neo | |
@var "n" | |
def all mod do | |
Neo.query!(""" | |
MATCH (#{@var}:#{class_name mod}) | |
RETURN #{@var} | |
""") |
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
[2] pry(main)> require "uri" | |
=> true | |
[3] pry(main)> URI "foo:3000" | |
=> #<URI::Generic foo:3000> | |
[4] pry(main)> |
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
~/work git clone https://github.com/vdaubry/youtube-multiple-dl.git 11:05:02 | |
Cloning into 'youtube-multiple-dl'... | |
remote: Counting objects: 175, done. | |
remote: Total 175 (delta 0), reused 0 (delta 0), pack-reused 175 | |
Receiving objects: 100% (175/175), 127.51 KiB | 0 bytes/s, done. | |
Resolving deltas: 100% (74/74), done. | |
Checking connectivity... done. | |
~/work cd youtube-multiple-dl 11:05:10 | |
~/work/youtube-multiple-dl rbenv local 2.2.0 master 11:05:13 | |
~/work/youtube-multiple-dl curl https://yt |
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
[10:32:07] smathy: shibly, but you can't reliably use the old gems with the new ruby. | |
[10:32:24] shibly: smathy, Why not? What's wrong? | |
[10:33:15] smathy: shibly, some gems have native (compiled) components, they won't work across different ruby versions. This all is why version managers (and bundler) were invented. | |
[10:37:00] smathy: shibly, chruby/rbenv and their install helpers: ruby-install or ruby-build | |
[10:37:23] shibly: smathy, If i use rvm, then will i be able to use older gem with newer ruby? | |
[10:37:52] smathy: shibly, no, you will never be able to do that for any gem that has a compiled component. | |
[10:40:00] shibly: smathy, If i use chruby/rbenv then will i be able to use older gems with newer ruby? |
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 Flattener | |
def flatten element, result=[] | |
if element.is_a? Array | |
element.each do |e| | |
flatten e, result | |
end | |
else | |
result << element | |
end | |
result |
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
[7] pry(main)> rand(1.year) | |
NoMethodError: undefined method `begin' for 31557600.0:Float | |
from /Users/jk/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.1.6/lib/active_support/duration.rb:115:in `method_missing' | |
[8] pry(main)> 1.year | |
=> 31557600.0 | |
[9] pry(main)> 31557600.0.class | |
=> Float | |
[10] pry(main)> rand(31557600.0) | |
=> 22083830 | |
[11] pry(main)> |
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
User # autoload | |
class User | |
class Twin | |
class Authentication < ::Disposable::Twin | |
include Sync | |
include Save | |
property :state | |
property :password_digest |
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
[25] pry(main)> itemStr = "../../lib/images/background/background.jpg" | |
=> "../../lib/images/background/background.jpg" | |
[26] pry(main)> itemStr.scan(/\.[0-9a-z]+$/i) | |
=> [".jpg"] | |
[27] pry(main)> |
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
~/work/r42 ag "\<smathy\>.*you should know" ~/.textual/logs master ~ 11:35:01 | |
/Users/jk/.textual/logs/freenode (35929)/Channels/#rubyonrails/2015-11-16.txt | |
779:[2015-11-16T14:47:50-0700] <smathy> ...I think the advice should be: "It's super advanced so you should know what you're doing, or hire/partner-with someone who does, otherwise you're fucked." | |
/Users/jk/.textual/logs/freenode (35929)/Channels/#rubyonrails/2016-01-04.txt | |
384:[2016-01-04T13:20:32-0700] <smathy> Yeah, you should know if "\0" is ever possibly going to be in your substring. | |
389:[2016-01-04T13:22:09-0700] <smathy> ...which you should know. | |
/Users/jk/.textual/logs/freenode (35929)/Channels/#RubyonRails-offtopic/2016-03-09.txt | |
128:[2016-03-09T14:40:48-0700] <smathy> tubbo, aww, you should know me by now, I think EVERYTHING you say matters |
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
[64] pry(main)> def run c, n=1000 | |
[64] pry(main)* ActiveRecord::Base.logger = nil | |
[64] pry(main)* Foo.connection.uncached do | |
[64] pry(main)* Benchmark.bm(10) do |b| | |
[64] pry(main)* b.report(:exception) { n.times do; Foo.find(rand(1..c)) rescue nil; end } | |
[64] pry(main)* b.report(:find_by) { n.times do; Foo.find_by(id: rand(1..c)); end } | |
[64] pry(main)* end | |
[64] pry(main)* end | |
[64] pry(main)* end | |
=> :run |
NewerOlder