Skip to content

Instantly share code, notes, and snippets.

@fernandoaleman
fernandoaleman / mysql2-m1.md
Last active October 1, 2024 01:46
How to install mysql2 gem on m1 Mac

Problem

Installing mysql2 gem errors on Apple silicon M1, M2 or M3 Mac running macOS Sonoma.

Solution

Make sure mysql-client, openssl and zstd are installed on Mac via Homebrew.

Replace mysql-client with whichever mysql package you are using

@joshdholtz
joshdholtz / .zshrc
Created October 27, 2021 19:16
Josh's M1 Mac Development Environment - homebrew, zsh
# ~/.zshrc
ZSH_DISABLE_COMPFIX=true
export ZSH="/Users/joshholtz/.oh-my-zsh"
# joshdholtz theme shows arch type in the prompt
ZSH_THEME="joshdholtz"
plugins=(git)
source $ZSH/oh-my-zsh.sh
# M1 and Rosetta
@barbolo
barbolo / benchamark_hash_to_json.rb
Last active September 24, 2022 03:32
Benchmark of JSON rendering in Ruby
# gem install multi_json json yajl-ruby oj benchmark-memory
require 'multi_json'
require 'json'
require 'yajl'
require 'oj'
require 'benchmark'
require 'benchmark-memory'
hash1 = {
@ufologist
ufologist / mobile-hls-video.html
Last active September 21, 2023 09:01
Web 前端如何播放 HLS(.m3u8) 视频
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mobile HLS video</title>
</head>
<body>
<h1>Mobile HLS video</h1>
@evantoli
evantoli / GitConfigHttpProxy.md
Last active September 27, 2024 17:17
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@ryanseys
ryanseys / play_mp3.rb
Created April 3, 2013 03:37
Play MP3 file in terminal using Ruby
pid = fork{ exec 'afplay', "song.mp3" } # on mac osx
@mikepfirrmann
mikepfirrmann / pretty-exception.rb
Created October 2, 2012 16:24
Print a prettier stack trace for Ruby exceptions
def colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
begin
# Here be dangerous things.
rescue => e
print "\r" << (' ' * 50) << "\n"
stacktrace = e.backtrace.map do |call|
if parts = call.match(/^(?<file>.+):(?<line>\d+):in `(?<code>.*)'$/)
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>