Skip to content

Instantly share code, notes, and snippets.

View mirzalazuardi's full-sized avatar
🙃

Mirzalazuardi mirzalazuardi

🙃
View GitHub Profile
# ~/.aliases
alias g='git'
alias o='nvim'
alias pbcopy='cat > ~/.vclipboard'
alias pbpaste='cat ~/.vclipboard'
alias ai-new='cat ~/dotfiles/ai-prompts/prompts/01-bootstrap.md | pbcopy && echo "Bootstrap prompt copied"'
alias ai-go='cat ~/dotfiles/ai-prompts/prompts/02-continue.md | pbcopy && echo "Continue prompt copied"'
alias ai-do='cat ~/dotfiles/ai-prompts/prompts/04-execute.md | pbcopy && echo "Execute prompt copied"'
alias ai-bug='cat ~/dotfiles/ai-prompts/prompts/03-debug.md | pbcopy && echo "Debug prompt copied"'
alias tb='nc termbin.com 9999'
@mirzalazuardi
mirzalazuardi / database.yml
Created November 12, 2024 04:32
trifecta solid config for sqlite3 in rails 8
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
encoding: utf8
development:
primary:
<<: *default
database: db/development.sqlite3
@mirzalazuardi
mirzalazuardi / 01.md
Created March 18, 2024 04:50 — forked from acfatah/01.md
How to set up Rails 6 production on Digital Ocean One Click Ruby on Rails Droplet

How to set up Rails 6 production on Digital Ocean One Click Ruby on Rails Droplet

1. Clone The Source

Clone the source repository.

2. Generate Secret Key

Run rails secret to generate secret key and set SECRET_KEY_BASE to the value later in ~/.profile.

@mirzalazuardi
mirzalazuardi / README.md
Created October 31, 2023 05:07 — forked from equivalent/README.md
Rails 7 importmaps dropzone.js direct upload ActiveStorage

This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.

#!/bin/sh
# echo sudo apt update
# sudo apt install -y curl net-tools tmux vim
# SLACK_WEBHOOK_URL=https://yourslackwebhookurl
hs=`hostname`
down_message="$hs logger is not running, please check"
while true
do
if nc -zw1 google.com 443; then
@mirzalazuardi
mirzalazuardi / .rspec
Created April 6, 2023 22:43 — forked from alistairtweed/.rspec
Testing Rails with RSpec, Factory Bot, Faker and Shoulda Matchers
--require spec_helper
# Dockerfile
FROM ruby:2.6.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs postgresql-client-11 graphviz &&\
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn
RUN mkdir /app
WORKDIR /app
ADD Gemfile /app/Gemfile
@mirzalazuardi
mirzalazuardi / scrap.rb
Last active May 19, 2020 01:54
scrapping with watir and nokogiri (dynamic js)
browser = Watir::Browser.new(:chrome, headless: true)
browser.goto(url)
doc = browser.element(css: 'html').wait_until(&:present?)
Nokogiri::HTML(doc.inner_html).css('html’)
@mirzalazuardi
mirzalazuardi / .pryrc
Created October 4, 2019 06:46
pry configuration
require 'rubygems'
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.config.editor = "nvim"
def pbcopy(input)
str = input.to_s
IO.popen('pbcopy', 'w') { |f| f << str }
str
@mirzalazuardi
mirzalazuardi / pipeline.php
Last active January 18, 2019 05:01
PHP #2
<?php
/**As part of a data processing pipeline, complete the implementation of the make_pipeline method:
- The method should accept a variable number of functions, and it should return a new function that accepts one parameter $arg.
- The returned function should call the first function in the make_pipeline with the parameter $arg, and call the second function with the result of the first function.
- The returned function should continue calling each function in the make_pipeline in order, following the same pattern, and return the value from the last function.
For example, Pipeline::make_pipeline(function($x) { return $x * 3; }, function($x) { return $x + 1; }, function($x) { return $x / 2; }) then calling the returned function with 3 should return 5.
**/
class Pipeline
{
public static function make_pipeline()