Skip to content

Instantly share code, notes, and snippets.

Sam Johnson sam0x17

Block or report user

Report or block sam0x17

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sam0x17
sam0x17 / Gemfile
Created Nov 17, 2019
How to get rails' 1.month and 3.seconds etc working in raw ruby
View Gemfile
gem 'active_support'
View gist:90a52cb74548bb7a47523fe4d41aa101
https://stackoverflow.com/a/34956689/4245513
@sam0x17
sam0x17 / ruby_fix.md
Created Nov 13, 2019
fix for installing ruby 2.5.x via RVM on macos
View ruby_fix.md

Error:

ossl_x509crl.cossl_x509cert.c:334:59: error: member reference type 'int' is not a pointer

Fix:

rvm install 2.5.7 --with-openssl-dir=`brew --prefix openssl`
@sam0x17
sam0x17 / settings.json
Created Aug 20, 2019
vscode multi-language indententation settings
View settings.json
"editor.tabSize": 2,
"editor.detectIndentation": true,
"[rust]": {
"editor.detectIndentation": true,
"editor.tabSize": 4
},
"[python]": {
"editor.detectIndentation": true,
"editor.tabSize": 4
}
@sam0x17
sam0x17 / docker.sh
Last active Aug 4, 2019
local docker environment setup
View docker.sh
# set up docker volume and image (host ~ will be bound to /host)
docker volume create devenv
mkdir -p ~/.alpine-dev
docker run -v ~:/host -it --mount source=devenv,target=/Users/sam/.alpine-dev --name alpine-dev alpine
# setup within container:
apk add bash
ln -fs /bin/bash /bin/sh
adduser sam
apk add sudo
@sam0x17
sam0x17 / fix.md
Created May 5, 2019
fix for firefox gtk3 (linux) dark mode theme issue
View fix.md

A partial fix is to add new string key to about:config with "widget.content.gtk-theme-override" name and "Adwaita:light" value.

View rust iterator equality stuff.rs
#[cfg(test)]
use std::fmt::Debug;
#[cfg(test)]
use std::cmp::PartialEq;
#[cfg(test)]
pub fn assert_iter_eq<T: Iterator, U: ExactSizeIterator>(a: T, b: U)
where
T: ExactSizeIterator,
<T as Iterator>::Item: Debug + PartialEq,
@sam0x17
sam0x17 / viewportheight.md
Last active Jan 25, 2019
True mobile viewport height
View viewportheight.md

mobile browsers these days have annoying address bars / toolbars / etc that interfere with the viewport height, so if you have some 100vh elements they get partially obscured... to get the TRUE height of the viewport use:

Math.min(document.documentElement.clientHeight, window.screen.height, window.innerHeight);
View gcf.cr
require "gcf"
class Example < GCF::CloudFunction
def run(params : JSON::Any)
# your code here
end
end
@sam0x17
sam0x17 / disable hotcorner
Created May 2, 2018
disable gnome activities top left hot corner
View disable hotcorner
install gnome extension: https://extensions.gnome.org/extension/118/no-topleft-hot-corner/
You can’t perform that action at this time.