- Read every row in the table
- No reading of index. Reading from indexes is also expensive.
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 'delegate' | |
module ConcatHelper | |
def concat(*elements, separator) | |
elements.reject(&:blank?).join(separator) | |
end | |
def format(format_string, string) | |
format_string % string unless string.blank? | |
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
defmodule FizzBuzz do | |
defmacro __using__(_) do | |
quote do | |
alias FizzBuzz.FunctionSignaturePatternMatching, as: FSPM | |
alias FizzBuzz.GuardClause | |
alias FizzBuzz.Case | |
alias FizzBuzz.Cond | |
alias FizzBuzz.If | |
import FizzBuzz.AnonymousFunction |
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 Obj | |
attr_reader :a | |
def initialize(a) | |
@a = a | |
end | |
def ==(other) | |
a == other.a | |
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
import time | |
class ContextManager(): | |
def __init__(self, generator_method, args, kwargs): | |
self.generator_method = generator_method | |
self.args = args | |
self.kwargs = kwargs | |
def __enter__(self): |
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
" How to process a set of files (includes escaping file name) and populate the arglist | |
" This example "copies" everything from quickfix to arglist | |
command! -nargs=0 -bar Qargs execute 'args' QuickfixFilenames() | |
function! QuickfixFilenames() | |
let buffer_numbers = {} | |
for quickfix_item in getqflist() | |
let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr']) | |
endfor | |
return join(map(values(buffer_numbers), 'fnameescape(v:val)')) | |
endfunction |
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
# this was copied from https://carc.in/#/r/fg2 | |
# thanks to @waterlink from this issue thread https://github.com/crystal-lang/crystal/issues/1388 | |
module CrChainableMethods | |
module Pipe | |
macro pipe(ast) | |
{% uast = ast.stringify.gsub(/ >>/, ".pipe").id %} | |
{% pp uast %} | |
{% if uast.stringify != ast.stringify %} | |
pipe {{uast}} |
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
# spec/features/twitter_timeline_spec.rb | |
require 'feature_helper' | |
RSpec.feature 'twitter timeline' do | |
scenario 'a user views a twitter timeline' do | |
visit root_path | |
within '[data-twitter-app]' do | |
within '[data-tweets]' do | |
expect(page).to have_css '.tweet', minimum: 2 |
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
# config/routes.rb | |
Rails.application.routes.draw do | |
root to: 'home#index' | |
end |
OlderNewer