Skip to content

Instantly share code, notes, and snippets.

@lopspower
lopspower / README.md
Last active May 28, 2024 13:18
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@obfusk
obfusk / break.py
Last active May 1, 2024 20:32
python "breakpoint" (more or less equivalent to ruby's binding.pry); for a proper debugger, use https://docs.python.org/3/library/pdb.html
import code; code.interact(local=dict(globals(), **locals()))
@bdurand
bdurand / row_lock_test.rb
Created October 18, 2012 17:07
ActiveRecord Row Lock Test
require 'rubygems'
require 'active_record'
require 'logger'
# Run as `ruby row_lock_test.rb [mysql|postgresql]` to see current Rails behavior when two processes
# try to destroy a record at the same time.
#
# Run as `ruby row_lock_test.rb [mysql|postgresql] patch` to see the behavior desired in pull request
# https://github.com/rails/rails/pull/7965
#