View settings.py
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
# ... | |
# Set the class as TEST_RUNNER in settings.py | |
TEST_RUNNER = 'app.test.TestRunner' |
View 1.js
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
// Paste this in linkedin my connections to toggle all "remove connection" menu and auto accept the confirmation dialog | |
Array.from(document.querySelectorAll(".mn-connection-card__dropdown-trigger")).forEach(button=>button.click()) | |
window.setInterval(function(){ | |
document.querySelectorAll('[data-control-name="confirm_removed"]')[0].click() | |
}, 100); |
View lines of code
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
git ls-files | xargs wc -l |
View flatten.rb
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
def flatten_array(array) | |
ans = [] | |
array&.each do |element| | |
if element.is_a? Array | |
ans += flatten_array(element) | |
else | |
ans << element | |
end | |
end | |
ans |
View gist:f59aea28ec769157bdfd42e079f9f04e
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
# https://stackoverflow.com/a/22933955 | |
git config --global push.default current | |
https://stackoverflow.com/a/22147540 | |
git config --global branch.autosetuprebase always | |
git config --global branch.autosetupmerge always | |
View regexes.rb
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
# https://rubular.com/r/RQobzZSU9KPSYI | |
usernames = /^[a-zA-Z]+[a-zA-Z0-9_.-]*$/ |
View flatten_array.rb
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
def flatten_array(array) | |
result = [] | |
array.each do |e| | |
if e.is_a? Array | |
result += flatten_array e | |
else | |
result << e | |
end | |
end | |
result |
View database.yml
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
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
timeout: 5000 | |
host: localhost | |
username: rails | |
password: rails | |
development: |
View police_catch_thieves.rb
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
def catch(arr, k) | |
ps = 0 | |
ts = 0 | |
count = 0 | |
arr.each do |e| | |
if e == 'T' | |
if ps > 0 | |
ps -= 1 | |
count += 1 |
View balance_bracets.rb
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
def balance(string) | |
offset = 0 | |
swaps = 0 | |
string.each_char do |c| | |
if c == '[' | |
if offset > 0 | |
swaps += offset | |
end | |
offset -= 1 | |
else |
NewerOlder