Skip to content

Instantly share code, notes, and snippets.

View unimatrixZxero's full-sized avatar
🌱
💎

Sam Figueroa unimatrixZxero

🌱
💎
View GitHub Profile
@ewpratten
ewpratten / hosts-yt-ads
Last active November 30, 2023 18:45
youtube ads hosts file
This project has been moved to a GitHub repository to allow Pull Requests.
See: https://github.com/Ewpratten/youtube_ad_blocklist
@bishboria
bishboria / springer-free-maths-books.md
Last active March 22, 2024 11:19
Springer made a bunch of books available for free, these were the direct links
@bignimbus
bignimbus / .vimrc
Last active October 12, 2022 11:19
Set iTerm2 title to current buffer in vim
" Set the title of the Terminal to the currently open file
function! SetTerminalTitle()
let titleString = expand('%:t')
if len(titleString) > 0
let &titlestring = expand('%:t')
" this is the format iTerm2 expects when setting the window title
let args = "\033];".&titlestring."\007"
let cmd = 'silent !echo -e "'.args.'"'
execute cmd
redraw!
@kentcdodds
kentcdodds / get-watchers.js
Last active December 4, 2023 22:34
Get Watchers of element and its children
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
@ChristianPeters
ChristianPeters / example_feature_spec.rb
Created June 27, 2014 14:03
Wait longer in Capybara
around { |example| with_wait_time(6) { example.run } }
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
#!/usr/bin/env python
# ./sscan.py input.mov rownumber output.png
# This is meant to be hyper-simple and makes
# some assumptions like: you want a row (not
# a column), the video is RGB (not gray), etc.
# Bug: frame_count is sometimes fractional.
# int() and the "if not okay" are workarounds.
anonymous
anonymous / untrusted-lvl10-solution.js
Created May 8, 2014 08:34
Solution to level 10 in Untrusted: http://alex.nisnevich.com/untrusted/
/*************
* ambush.js *
*************
*
* Oh. Oh, I see. This wasn't quite part of the plan.
*
* Looks like they won't let you take the Algorithm
* without a fight. You'll need to carefully weave your
* way through the guard drones.
*
@mockdeep
mockdeep / spec_helper.rb
Last active October 7, 2019 07:19
A spec helper file for managing database cleaner configuration
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.treat_symbols_as_metadata_keys_with_true_values = true
module ExponentialBackoff
def self.retry_with_exponential_backoff *args
opts = { max: 3 }
opts.merge!(args.pop) if args.last.is_a?(Hash)
attempt = 0
begin
yield
rescue *args
if attempt < opts[:max]
attempt += 1