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 'thread' | |
| class RackDrain | |
| @@queue = Queue.new | |
| def self.start_request | |
| self.queue << :request | |
| end | |
| def self.end_request | |
| self.queue.pop |
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 'spec_helper' | |
| describe Interaction do | |
| TestInteraction = Class.new(Interaction) do | |
| model :user | |
| string :first_name | |
| model_fields user: [:first_name] | |
| end | |
| describe ".model_fields" do |
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 'delayed/backend/active_record' | |
| module Delayed | |
| module Backend | |
| module ActiveRecord | |
| class Job < ::ActiveRecord::Base | |
| def destroy | |
| retries = 0 | |
| begin | |
| super |
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
| # https://github.com/garybernhardt/selecta/issues/30 | |
| def compute_match_length(choice, query) | |
| # Check for exact match | |
| return query.length if choice.index(query) | |
| query_chars = query.chars | |
| # Extract longest possible substring | |
| first_index = choice.index(query_chars.first) |
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
| ready "codepoints" do | |
| before do | |
| @str = "a" * 30 + "x" | |
| end | |
| go "index many matches" do | |
| index = @str.index("a") | |
| while index | |
| index = @str.index("a", index + 1) | |
| 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
| class Foo < SimpleDelegator | |
| def in(&block) | |
| instance_eval &block | |
| end | |
| def have_awesomeness | |
| matcher do |target| | |
| expect(target).to eq 3 | |
| end | |
| 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 'socket' | |
| require 'benchmark' | |
| puts Benchmark.measure { Socket::gethostbyname(Socket::gethostname) } | |
| # 0.000000 0.000000 0.000000 ( 5.004441) | |
| # fix, in /etc/hosts: 127.0.0.1 localhost my-host.local | |
| # OR: enable IPv6 |
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
| FUNCTION neocomplete#handler#_on_write_post() | |
| Called 1 time | |
| Total time: 0.000068 | |
| Self time: 0.000068 | |
| count total (s) self (s) | |
| " Restore foldinfo. | |
| 1 0.000040 for winnr in filter(range(1, winnr('$')), "!empty(getwinvar(v:val, 'neocomplete_foldinfo'))") | |
| let neocomplete_foldinfo = getwinvar(winnr, 'neocomplete_foldinfo') | |
| call setwinvar(winnr, '&foldmethod', neocomplete_foldinfo.foldmethod) |
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
| EditorState = require './editor-state' | |
| describe "", -> | |
| [editor, editorView] = [] | |
| beforeEach -> | |
| waitsForPromise -> atom.workspace.open() | |
| runs -> | |
| editor = atom.workspace.getActiveTextEditor() | |
| editorView = atom.views.getView(editor) |
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
| #!/usr/bin/env ruby | |
| PATH = File.expand_path('../..', __FILE__) | |
| PACKAGES_TXT = File.join(PATH, "packages.txt") | |
| def package_list | |
| "apm list --installed --bare --dev false" | |
| end | |
| def main |
OlderNewer