Skip to content

Instantly share code, notes, and snippets.

Jeroen Visser jeroenvisser101

Block or report user

Report or block jeroenvisser101

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
@jeroenvisser101
jeroenvisser101 / cookies.js
Created Jul 22, 2018
Set browser-wide cookies with Puppeteer
View cookies.js
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 Mar 29, 2018 — forked from panoply/Issue.md
Elixir Issue because I'm a dumb shit.
View Issue.md

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 Apr 1, 2017
Material design shadow mixin
View _material-shadow.scss
@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 Sep 4, 2019
Hide Safari contacts auto-fill when [autocomplete="off"]
View safari.css
input[autocomplete="off"]::-webkit-contacts-auto-fill-button {
visibility: hidden;
display: none !important;
pointer-events: none;
height: 0;
width: 0;
margin: 0;
}
View many_to_many.rb
class Campaign
field :name
# ...
has_many :shortcodes_services
has_many :phone_numbers, through: :campaigns_phone_number
end
class CampaignsPhoneNumber
belongs_to :campaign
View invite_demo.php
<?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
Simple image optimisation in image_optim
View assets.rake
# 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
View gist:f89101b2ae2bcf00c4e4aff0d5c547fd
Verifying that +jeroenvisser101 is my blockchain ID. https://onename.com/jeroenvisser101
@jeroenvisser101
jeroenvisser101 / git-move-to-branch
Last active Mar 4, 2016
Script that moves a specified number of commits into a branch (when accidentally committed to master)
View git-move-to-branch
#!/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]
You can’t perform that action at this time.