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 Task | |
class_inheritable_accessor :foo | |
self.foo = [] | |
class_attribute :bar | |
self.bar = [] | |
end | |
class Subtask < Task | |
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
#!/bin/bash | |
PREV=146 # 146 is the currently known bad version | |
START=147 | |
STOP=149 | |
rails new zachs-sample-rails-app -d postgresql && | |
cd zachs-sample-rails-app && | |
\rm .git/hooks/pre-commit && | |
git add . && |
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 { | |
Component, | |
OnInit, | |
Input, | |
OnDestroy, | |
ViewChild, | |
} from '@angular/core'; | |
import { Order } from '../../orders/order'; | |
import { Subscription } from 'rxjs'; | |
import { ActivatedRoute, Data } from '@angular/router'; |
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 { | |
Component, | |
OnInit, | |
Input, | |
OnDestroy, | |
ViewChild, | |
} from '@angular/core'; | |
import { Order } from '../../orders/order'; | |
import { Subscription } from 'rxjs'; | |
import { ActivatedRoute, Data } from '@angular/router'; |
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 SomeModel < ::ActiveRecord::Base | |
default_scope -> { select('id') } } | |
end | |
# only select id | |
SomeModel.where(name: 'Wibble').all | |
# override and select all columns | |
SomeModel.unscoped.where(name: 'Wibble').all |
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
compute_hash() { | |
git s | grep $1 | cut -d" " -f2 | xargs cat | md5 | |
} | |
HSH=`compute_hash rb` | |
for i in `seq 1 100000` ; do | |
NHSH=`compute_hash rb` | |
if [ "$HSH" != "$NHSH" ] ; then | |
git s | grep rb | xargs rubocop | |
else | |
echo -n '.' |
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 'capybara/rails' | |
require 'capybara_spa' | |
require 'selenium/webdriver' |
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
# browser_logging.rb will print out the browser log from Chrome | |
# when running specs with "js: true". This is so we can easily debug | |
# issues where there are JS errors or other console warnings/error(s), etc. | |
# | |
# Output file is: Rails.root/log/browser.log | |
# | |
# Note: Nothing will be printed out for non-JS examples. | |
RSpec.configure do |config| | |
browser_log = File.new(Rails.root.join("log/browser.log").to_s, "w") | |
browser_log.sync = true |
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
> gem install -r rails -v 5.2.0 | |
Successfully installed rails-5.2.0 | |
1 gem installed |
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
function findNodeAtPosition(node, position) { | |
const result = { node: undefined, offset: undefined, found: false, currentPosition: 0 }; | |
return findNodeAtPositionWithResult(result, node, position); | |
} | |
function findNodeAtPositionWithResult(result, node, position, indent = ' ') { | |
console.log(indent + 'findNodeAtPositionWithResult: ', result, node, position); | |
let currentPosition = result.currentPosition; | |
let childNode; |