Skip to content

Instantly share code, notes, and snippets.

Avatar

Jahfer Husain jahfer

View GitHub Profile
@jahfer
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.remove_silencers!
Rails.backtrace_cleaner.add_silencer { |line| not line =~ /^(components)\// }
puts Rails.backtrace_cleaner.clean(trace)
super
puts "---------------"
end
end
@mcmanus
mcmanus / trrprefs.md
Last active Jul 13, 2018 — forked from bagder/trrprefs.md
trr prefs
View trrprefs.md

Preferences

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.

network.trr.mode

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
kristianpd / admin.md
Last active Jun 25, 2018
History of Admin Next
View admin.md
@addyosmani
addyosmani / README.md
Last active Oct 18, 2020 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger
View README.md

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
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: http://caniuse.com/#feat=viewport-units
*
* 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: http://www.iosres.com/
*/
@woxtu
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};
#[repr(C)]
pub struct HaarClassifierCascade;
#[repr(C)]
pub struct MemStorage;
@paulrouget
paulrouget / ff.md
Last active Mar 11, 2019 — forked from operatorjen/ff.md
Hacking Firefox
View ff.md
@demisx
demisx / active_record_objects_autosave.md
Last active Aug 27, 2020
When Active Record Child Objects are Autosaved in Rails
View active_record_objects_autosave.md

belongs_to:

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

has_one:

  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
cjoudrey / README.md
Last active Dec 27, 2015
File uploads in Batman
View README.md

File uploads in Batman

Problem

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.