Skip to content

Instantly share code, notes, and snippets.

View jeroenvisser101's full-sized avatar
🇺🇦
Слава Україні!

Jeroen Visser jeroenvisser101

🇺🇦
Слава Україні!
View GitHub Profile
class Campaign
field :name
# ...
has_many :shortcodes_services
has_many :phone_numbers, through: :campaigns_phone_number
end
class CampaignsPhoneNumber
belongs_to :campaign
@jeroenvisser101
jeroenvisser101 / _material-shadow.scss
Created April 1, 2017 16:09
Material design shadow mixin
@mixin material-shadow($level: 1) {
@if $level == 1 {
box-shadow: 0 1px 3px rgba(#000, .12),
0 1px 2px rgba(#000, .24);
} @else if $level == 2 {
box-shadow: 0 3px 6px rgba(#000, .16),
0 3px 6px rgba(#000, .23);
} @else if $level == 3 {
box-shadow: 0 10px 20px rgba(#000, .19),
0 6px 6px rgba(#000, .23);
@jeroenvisser101
jeroenvisser101 / Issue.md
Last active March 29, 2018 18:27
Elixir Issue because I'm a dumb shit.

Cannot seem to get desired response through relationship. Must be missing some step here. How does one return with the relationship?

@jeroenvisser101
jeroenvisser101 / git-finish
Last active December 19, 2018 16:18
Merge a branch using --ff-only, check status checks, and remove branches locally and on remote.
#!/usr/bin/env ruby
def notice(text)
puts "\e[33m#{text}\e[0m"
end
def success(text)
puts "\e[32m#{text}\e[0m"
end
def error(text)
@jeroenvisser101
jeroenvisser101 / TorDetector.php
Last active September 29, 2019 10:59
Detecting people that use Tor
<?php
/**
* Class TorDetector
*
* Helps to detect if visitors are using a Tor browser to surf the website.
*
* Thanks to https://trac.torproject.org/projects/tor/wiki/doc/TorDNSExitList
*/
class TorDetector
// Put this in a folder together with the "svg" folder from Twemoji. Create a new folder next to it called "flags".
const fs = require("fs");
const path = require("path");
// country code regex
const CC_REGEX = /^[a-z]{2}$/i;
// offset between uppercase ascii and regional indicator symbols
const OFFSET = 127397;
@jeroenvisser101
jeroenvisser101 / safari.css
Last active May 9, 2023 01:31
Hide Safari contacts auto-fill when [autocomplete="off"]
input[autocomplete="off"]::-webkit-contacts-auto-fill-button {
visibility: hidden;
display: none !important;
pointer-events: none;
height: 0;
width: 0;
margin: 0;
}
@jeroenvisser101
jeroenvisser101 / cookies.js
Created July 22, 2018 20:41
Set browser-wide cookies with Puppeteer
export const setCookies = async (page, cookies) => {
const items = cookies
.map(cookie => {
const item = Object.assign({}, cookie);
if (!item.value) item.value = "";
console.assert(!item.url, `Cookies must have a URL defined`);
console.assert(
item.url !== "about:blank",
`Blank page can not have cookie "${item.name}"`
);