Skip to content

Instantly share code, notes, and snippets.

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

Jeroen Visser jeroenvisser101

🇺🇦
Слава Україні!
View GitHub Profile
// 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 / 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}"`
);
@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 / _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 / 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;
}
class Campaign
field :name
# ...
has_many :shortcodes_services
has_many :phone_numbers, through: :campaigns_phone_number
end
class CampaignsPhoneNumber
belongs_to :campaign
<?php
use Invitious\Invitious;
// Basic code
echo Invitious::generate(Invitious::ENGLISH_WORD_GENERATOR);
// Custom length
echo Invitious::generate(Invitious::ENGLISH_WORD_GENERATOR, 4);
// Custom separator
@jeroenvisser101
jeroenvisser101 / assets.rake
Created May 6, 2016 10:05
Simple image optimisation in image_optim
# lib/tasks/assets.rake
require 'image_optim'
require 'image_optim/runner'
namespace :assets do
desc 'Runs image_optim on the assets.'
task :optimize do
image_optim = ImageOptim::Runner.new(recursive: true)
image_optim.run!(Dir['app/**/*.{svg,jpg,png,jpeg,gif}'])
end
end
Verifying that +jeroenvisser101 is my blockchain ID. https://onename.com/jeroenvisser101
@jeroenvisser101
jeroenvisser101 / git-move-to-branch
Last active March 4, 2016 14:58
Script that moves a specified number of commits into a branch (when accidentally committed to master)
#!/usr/bin/env ruby
# Get values from
branch_name = ARGV[0]
commit_count = ARGV[1].to_i > 0 ? ARGV[1].to_i : 1
# If no branch is given, or it is a question for help, show usage
if branch_name.nil? or ['-h', '--help'].include? branch_name
puts <<-USAGE
usage: git move-to-branch <branch name> [commits]