Skip to content

Instantly share code, notes, and snippets.

@reyesyang
reyesyang / link_text_overflow.css
Created Jun 28, 2013
Hidden overflow text in link element
View link_text_overflow.css
@reyesyang
reyesyang / mysql_outfile.sql
Created Feb 25, 2014
Export MySQL query result to CSV file
View mysql_outfile.sql
SELECT id, username, (total_point - spent_point) AS point
FROM users
ORDER BY point DESC
LIMIT 50
INTO OUTFILE '/tmp/bbs_points_top50.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
;
@reyesyang
reyesyang / .gemrc
Created Jun 22, 2017 — forked from jch/.gemrc
gemrc example
View .gemrc
# http://docs.rubygems.org/read/chapter/11
---
gem: --no-ri --no-rdoc
benchmark: false
verbose: true
update_sources: true
sources:
- http://gems.rubyforge.org/
- http://rubygems.org/
backtrace: true
@reyesyang
reyesyang / .gtkrc-eclipse
Created Jun 6, 2017 — forked from andrioli/.gtkrc-eclipse
Config to make Eclipse Juno icons and tabs look small and nice in Linux
View .gtkrc-eclipse
# Create a new file in your home directory called .gtkrc-eclipse
# call eclipse with this command:
# Gtk2 forced:
# export SWT_GTK3=0
# env GTK2_RC_FILES=/usr/share/themes/<YourTheme>/gtk-2.0/gtkrc:/home/<YourUser>/.gtkrc-eclipse '/path_to_eclipse/eclipse'
# In your Eclipse directory find the file 'e4_default_gtk.css'
# In this file there's a CSS class:
@reyesyang
reyesyang / grape-i18n-zh-CN.yml
Last active Apr 22, 2017
Grape I18n translation in zh-CN language
View grape-i18n-zh-CN.yml
# Usage:
# 1. Put this file in config/locales/grape/zh-CN.yml
# 2. Set load_path in config/application.rb as below:
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
zh-CN:
grape:
errors:
format: ! '%{attributes} %{message}'
messages:
@reyesyang
reyesyang / bootstrap.sh
Created Mar 18, 2017
Bootstrap a fresh ubuntu machine with dev tools
View bootstrap.sh
#!/bin/bash
echo '***** Build tools *****'
sudo apt install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev
echo '***** Dev tools *****'
sudo apt install -y git gitg tmux vim-gnome exuberant-ctags memcached redis-server\
mysql-server mongodb postgresql haskell-platform libmysqlclient-dev ipython python-dev\
libsqlite3-dev ubuntu-make
@reyesyang
reyesyang / net_http.rb
Last active Jun 2, 2016
Net::HTTP examples
View net_http.rb
require 'net/http'
# Proxy
proxy_server = 'xxx.xxx.xxx.xxx'
proxy_port = 81
## Example 1
Net::HTTP.new('baidu.com', nil, proxy_server, proxy_port).start { |http| http.get '/' }
## Example 2
@reyesyang
reyesyang / clear_after.css
Created Dec 20, 2013
Clear float with :after
View clear_after.css
&:after {
content: ".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
View solarized-dark.css
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
View eigenclass.rb
class Object
def eigenclass
class << self; self; end
end
end