Skip to content

Instantly share code, notes, and snippets.

View kwhandy's full-sized avatar
🍉
sharing-is-caring

Handy Wardhana kwhandy

🍉
sharing-is-caring
View GitHub Profile
version: "3.8"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.10
container_name: search-server
ports:
- "9200:9200"
environment:
- discovery.type=single-node
- cluster.name=mecha
@kwhandy
kwhandy / README.md
Created September 10, 2022 07:35 — forked from leastbad/README.md
Choices.js Stimulus wrapper preview

Choices.js Stimulus wrapper

https://joshuajohnson.co.uk/Choices/

Soon, this will be published as an NPM package, but there's an absence of documentation right now. It supports almost all functions from the original library; soon it will support 100% of them.

This wrapper adds Ajax pre-fetch search. Happens if controller has a data-search-path attribute.

Stimulus controller targets use new v2 syntax. Controller attaches a reference to itself on the element so that you can access the internal state from external scripts.

@kwhandy
kwhandy / .gitpod.Dockerfile
Last active July 28, 2022 08:36
Gitpod Custom Configs – @kwhandy
FROM gitpod/workspace-full
# Install Ruby
ENV RUBY_VERSION=3.1.2
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm install ruby-$RUBY_VERSION && rvm use ruby-$RUBY_VERSION --default"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc
# Install Node and Yarn
@kwhandy
kwhandy / post.rb
Created December 13, 2021 05:28 — forked from matenia/post.rb
Use custom method for FriendlyId (Example)
class Post < ActiveRecord::Base
# for SO: http://stackoverflow.com/questions/10481389/friendly-id-with-two-parameters
# EXAMPLE ASSUMES YOU ARE USING FRIENDLYID 4.X
# AND THAT YOU HAVE A SLUG:STRING COLUMN ON THE MODEL
# ...
extend FriendlyId
friendly_id :generate_custom_slug, :use => :slugged
# ...
@kwhandy
kwhandy / creative-cloud-disable.md
Created August 7, 2021 12:45 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@kwhandy
kwhandy / memcached_macosx.md
Created July 24, 2021 13:16 — forked from tomysmile/memcached_macosx.md
Installing memcached on Mac with Homebrew and Lunchy

Installing memcached on Mac with Homebrew and Lunchy

This is a quick guide for installing memcached on a Mac with Homebrew, and starting and stopping it with Lunchy. I hope this tutorial will get your memcached up and running in no time.

Step 1 — Install Homebrew

Installing Homebrew is super easy. Just paste this in your terminal —

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@kwhandy
kwhandy / AppWorld.vue
Created December 18, 2020 05:59 — forked from pxwee5/AppWorld.vue
Static Vue SFC
<template>
<span>World</span>
</template>
<script>
module.exports = {
mounted () {
console.log('Hello World')
}
}
@kwhandy
kwhandy / index.html
Created December 18, 2020 05:58 — forked from pxwee5/index.html
Static Vue SFC
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello World</title>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/http-vue-loader"></script>
</head>
<body>
<h1>Static HTML With Vue.js Single File Component</h1>
@kwhandy
kwhandy / Part1. Basic
Created September 29, 2020 12:42 — forked from DerevenetsArtyom/Part1. Basic
[Upload Images with AJAX] #django #ajax
# Ajax jQuery
function upload(event) {
event.preventDefault();
var data = new FormData($('#ajax').get(0));
console.log(data)
$.ajax({
url: '/image_load/', // same url 'action' in form
type: 'POST',
data: data,
@kwhandy
kwhandy / lightsail-ssh.md
Last active September 28, 2020 06:56
How to EASILY FUCKIN CONNECT YOUR MACHINE to LIGHTSAIL INSTANCE(S)

Download Default Key

Setup your Machine(Mac/ Linux) for working with fuckin AWS Lightsail

Generate a RSA Key on Your Machine

Skip this if you have sensitive auth previously with your existing Key(id_rsa or id_ed..)

ssh-keygen -t rsa -b 4096 -N '' -C "<your fuckin email according AWS IAM>" -f ~/.ssh/id_rsa