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 / dropzone_controller.js
Last active September 25, 2024 14:28
Dropzone.js + Stimulus + Active Storage
import { Controller } from "stimulus"
import { DirectUpload } from "@rails/activestorage"
import Dropzone from "dropzone"
import { getMetaValue, findElement, removeElement, insertAfter } from "helpers"
Dropzone.autoDiscover = false
export default class extends Controller {
static targets = [ "input" ]
@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 October 14, 2024 23:28
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 August 20, 2024 23:34
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"