Skip to content

Instantly share code, notes, and snippets.

View zernie's full-sized avatar
🏠
Working from home

zernie zernie

🏠
Working from home
View GitHub Profile
@kennethnwc
kennethnwc / .dockerignore
Last active July 28, 2024 08:09
My docker-compose with nextjs and nginx
.next/
node_modules/
Dockerfile
yarn-error.log
.dockerignore
.git
.gitignore
@leastbad
leastbad / application_controller.rb
Created November 20, 2020 20:19
Nate's flash setup
add_flash_types :primary, :secondary, :success, :danger, :warning, :info, :light, :dark
@lazaronixon
lazaronixon / _form.html.erb
Last active March 28, 2025 10:19
Dropzone.js + Stimulus + Active Storage + CSS Zero (2025)
<%= form_with(model: billboard) do |form| %>
<%= tag.div class: "dropzone", data: { controller: "dropzone", dropzone_param_name_value: "billboard[images][]", dropzone_url_value: rails_direct_uploads_url, dropzone_accepted_files_value: "image/*", dropzone_max_files_value: 3, dropzone_max_filesize_value: 0.300 } do %>
<div class="dz-default dz-message flex flex-col items-center">
<%= image_tag "upload.svg", size: 28, class: "colorize-black", aria: { hidden: true } %>
<h5 class="font-semibold mbs-4">Drop files here or click to upload.</h5>
<p class="text-sm text-subtle">Upload up to 10 files.</p>
</div>
<% end %>
<div class="inline-flex items-center mbs-2 mie-1">
@sanusart
sanusart / 0-readme.md
Last active November 9, 2022 10:45
Use custom icons in Antd v3 #antd #ant-design #icons #webpack

Ant design v3.9.0 custom svg icons and icons overrides

Why?

  • If you need to use material icons in your project for example.
  • If you need to add cusom icons

Preparations

File examples bellow

@danieldraper
danieldraper / application_form.rb
Last active September 10, 2020 06:17
Service object and form object using ActiveModel and dry-rb
require "dry/monads/result"
class ApplicationForm
include Dry::Monads::Result::Mixin
include ActiveModel::Model
def self.attribute(name, options = {})
self.send(:attr_accessor, name)
_attributes << Attribute.new(name, options)
end
@mrcoles
mrcoles / console-group-decorator.d.ts
Last active March 22, 2021 01:49
A decorator for wrapping a function in a `console.group(msg)` -> `console.groupEnd()` call.
export function groupCollapsedFn<F extends Function>(
msg: any, func: F,
): F;
export function groupFn<F extends Function>(
msg: any, func: F, isCollapsed?: boolean
): F;
@hubgit
hubgit / SelectField.tsx
Last active March 31, 2025 22:59
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
@tegansnyder
tegansnyder / Preventing-Puppeteer-Detection.md
Created February 23, 2018 02:41
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',
@ipepe
ipepe / install-chrome-headless.sh
Last active February 10, 2025 16:14
Installing headless chrome on Ubuntu.
#!/bin/bash
# from https://chromium.woolyss.com/
# and https://gist.github.com/addyosmani/5336747
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
chromium-browser --headless --no-sandbox http://example.org/
@jaxn
jaxn / application_system_test_case.rb
Last active September 19, 2017 17:14
Migrate to chromedriver from capybara-webkit for Rails with WSL support
require 'test_helper'
# Capybara driver chosen based on the value of ENV['TEST_WITH_CHROME']
# - `false` - use capybara-webkit
# - `headless` - chromedriver in headless mode
# - `true` (or any other value) - chromedriver in a Window
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
if ENV['TEST_WITH_CHROME'] && ENV['TEST_WITH_CHROME'] != 'false'
require "selenium/webdriver"