Skip to content

Instantly share code, notes, and snippets.

@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@whunter
whunter / adb_rotation.sh
Created February 9, 2016 18:13
android device display rotation via adb
# disable auto rotation
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
# force landscape
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
# back to portrait
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0
# upside down
@steve-chavez
steve-chavez / docker-compose.yml
Created July 12, 2018 19:35
Quickstart for PostgREST with TimescaleDB
version: '3'
services:
db:
image: timescale/timescaledb:latest-pg10
ports:
- "5432:5432"
environment:
POSTGRES_DB: devices_small
POSTGRES_USER: app_user
pgrest:
@teamon
teamon / Dockerfile
Created August 31, 2018 10:28
elixir + phoenix + node dockerfile
########################################
# 1. Build nodejs frontend
########################################
FROM node:10.9-alpine as build-node
# prepare build dir
RUN mkdir -p /app/assets
WORKDIR /app
# set build ENV
@keathley
keathley / .credo.exs
Last active December 30, 2023 16:13
Keathley's credo file
# This file contains the configuration for Credo and you are probably reading
# this after creating it with `mix credo.gen.config`.
#
# If you find anything wrong or unclear in this file, please report an
# issue on GitHub: https://github.com/rrrene/credo/issues
#
%{
#
# You can have as many configs as you like in the `configs:` field.
configs: [
@joshchernoff
joshchernoff / index.ex
Last active September 26, 2021 04:55
Add pagination to your Phoenix LiveView project with Dissolver and live_patch https://github.com/MorphicPro/dissolver
# lib/my_app_web/live/post_live/index.ex
defmodule MyAppWeb.PostLive.Index do
use MyAppWeb, :live_view
alias MyApp.Blog
@impl true
def mount(_params, _session, socket) do
{:ok, socket}
╔══════════╦═══════════════════╦══════════════════════════════════════════════════════════════════════════╦════════════════════════╦════════════════════════════════════╦════════════════════════╗
║ Operator ║ Tipe Data Operand ║ Deskripsi ║ Contoh Data ║ Contoh penggunaan Operator ║ Hasil ║
╠══════════╬═══════════════════╬══════════════════════════════════════════════════════════════════════════╬════════════════════════╬════════════════════════════════════╬════════════════════════╣
║ @> ║ jsonb ║ Apakah nilai x ada di data JSON? ║ {"a":1, "b":2}' ║ ::jsonb @> '{"b":2}'::jsonb ║ {"a":1, "b":2}' ║
║ <@ ║ jsonb ║ Apakah nilai data JSON mengandung nilai x ? ║ {"b":2}' ║ ::jsonb <@ '{"a":1, "b":2}'::jsonb ║ {"b":2}' ║
║ ? ║ text ║ Apakah key terat
@mattdanielbrown
mattdanielbrown / fixed-bottom-nav-w-tailwind.markdown
Created February 21, 2021 18:31
Fixed Bottom Nav w/ Tailwind
@samselikoff
samselikoff / tailwind.config.js
Created April 16, 2021 15:57
Firefox plugin for Tailwind CSS. Add styles that target Firefox browser only.
const plugin = require("tailwindcss/plugin");
module.exports = {
mode: "jit",
purge: {
content: ["./src/**/*.{js,ts,jsx,tsx,mdx,vue}"],
},
theme: { extend: {} },
variants: {},
plugins: [