Skip to content

Instantly share code, notes, and snippets.


Jahfer Husain jahfer

View GitHub Profile
jahfer / active_record_test_logger.rb
Last active Nov 26, 2019
Small tweak to output Active Record logs inside of a test with the stacktrace attached
View active_record_test_logger.rb
module MyLogSubscriber
def sql(*args)
trace = caller
Rails.backtrace_cleaner.add_silencer { |line| not line =~ /^(components)\// }
puts Rails.backtrace_cleaner.clean(trace)
puts "---------------"
mcmanus /
Last active Jul 13, 2018 — forked from bagder/
trr prefs


All preferences for the DNS-over-HTTPS (DoH) functionality in Firefox are located under the "network.trr" prefix (TRR == Trusted Recursive Resolver). The support for these landed in Firefox 60 and has been improved in Firefox 61. Goto about:config to set these preferences.

Some users have reported needing to restart to have the changes take effect. The DNS tab of the about:networking page will indicate whether a name was resolved via TRR or not.


set this preference to 2 to enable DoH in a mode where DoH is used as the first choice for DNS, but it will still fallback to native DNS for full backwards compatibility. Set to 0 to disable DoH.

kristianpd /
Last active Jun 25, 2018
History of Admin Next
addyosmani /
Last active Oct 18, 2020 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

pburtchaell / styles.css
Last active Oct 8, 2020
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
View styles.css
* VH and VW units can cause issues on iOS devices:
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
* iOS Resolution Quick Reference:
woxtu / gist:c186b173be3a53171533
Last active Mar 4, 2019
Face detection in Rust
View gist:c186b173be3a53171533
pub mod cv {
extern crate libc;
use self::libc::{c_char, c_double, c_int, c_schar, c_void};
pub struct HaarClassifierCascade;
pub struct MemStorage;
paulrouget /
Last active Mar 11, 2019 — forked from operatorjen/
Hacking Firefox
demisx /
Last active Aug 27, 2020
When Active Record Child Objects are Autosaved in Rails


  1. Assigning an object to a belongs_to association does not automatically save the object. It does not save the associated object either.


  1. When you assign an object to a has_one association, that object is automatically saved (in order to update its foreign key).
  2. In addition, any object being replaced is also automatically saved, because its foreign key will change too
  3. If either of these saves fails due to validation errors, then the assignment statement returns false and the assignment itself is cancelled.
  4. If the parent object (the one declaring the has_one association) is unsaved (that is, new_record? returns true) then the child objects are not saved. They will automatically when the parent object is saved.
cjoudrey /
Last active Dec 27, 2015
File uploads in Batman

File uploads in Batman


When you use input type="file" in Batman, the change event is observed and node.files is used to obtain the file when it changes.

In browsers that do not support the FileReader API node.files will be undefined.

Strategy used in Shopify

You can’t perform that action at this time.