Skip to content

Instantly share code, notes, and snippets.

View dannyh79's full-sized avatar

Cheng-Hsuan "Danny" Han dannyh79

View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active April 29, 2024 19:31
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@dznz
dznz / gist:8552522
Last active December 16, 2020 09:15
Two different ways to plug in a simple Warden failure app to a Rails project.
##
# Simple Warden configuration, complex "controller"
# In config/initializers/warden.rb
Rails.application.config.middleware.use Warden::Manager do |manager|
manager.failure_app = UnauthorizedController
end
# app/controllers/unauthorized_controller.rb
class UnauthorizedController < ActionController::Metal
@lfender6445
lfender6445 / gist:9919357
Last active March 28, 2024 08:38
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@cferdinandi
cferdinandi / terminal-cheat-sheet.txt
Last active April 24, 2024 17:51
Terminal Cheat Sheet
# Terminal Cheat Sheet
pwd # print working directory
ls # list files in directory
cd # change directory
~ # home directory
.. # up one directory
- # previous working directory
help # get help
-h # get help
@Brainiarc7
Brainiarc7 / fstab-generate-arch.md
Last active March 18, 2024 13:51
Generate fstab in Arch Linux

First, install arch-install-scripts:

sudo pacman -S --needed arch-install-scripts

Secondly, mount your partitions in all the internal hard drives.

Thirdly, generate and validate your config by piping it out to stdout:

@fernandoaleman
fernandoaleman / fix-libv8-mac.txt
Created May 5, 2016 15:14
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
@HaleTom
HaleTom / print256colours.sh
Last active April 14, 2024 13:35
Print a 256-colour test pattern in the terminal
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256

error info:

➜  hh (develop-hh) ✔ gem install libv8 -v '3.16.14.11'
Building native extensions.  This could take a while...
ERROR:  Error installing libv8:
	ERROR: Failed to build gem native extension.

    current directory: /Users/simonqian/.rvm/gems/ruby-2.2.2/gems/libv8-3.16.14.11/ext/libv8
/Users/simonqian/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20170410-48026-19k49a7.rb extconf.rb
creating Makefile
@vladikoff
vladikoff / gist:d3f5ec1f570e66fb7faff329d01012b7
Created May 1, 2017 16:15 — forked from crossjs/gist:0e11d36849db3fbf88fa64b63e121d5f
Generate an AUTHORS file based on the output of git shortlog.
#!/usr/bin/env sh
# Generate an AUTHORS file based on the output of git shortlog. It uses ABC
# order, strips out leading spaces and numbers, then filters out specific
# authors.
git shortlog -se \
| perl -spe 's/^\s+\d+\s+//' \
| sed -e '/^CommitSyncScript.*$/d' \
> AUTHORS
@shaiguitar
shaiguitar / gist:627d52ebc0c03af488477b5d636a8909
Created August 31, 2017 22:27
Using docker compose to mount current working directory dynamically into the container
# mount volume PWD on host to /app in container.
shai@lappy ~/tmp/example-working-docker-compose-environment-vars [master *] ± % cat docker-compose.yml
version: "3"
services:
some_server:
...
volumes:
- $PWD:/app