Skip to content

Instantly share code, notes, and snippets.

@aNd1coder
aNd1coder / compass.bat
Created October 10, 2013 04:55
custom compass compiled css filename
@ruby.exe -x "%~dpnx0" %*
goto :eof
#!ruby
module Compass
module Actions
end
end
require "compass/compiler"
module Compass
@aNd1coder
aNd1coder / config.rb
Last active September 9, 2018 17:49
config.rb for compass
# 默认编码
Encoding.default_external = "utf-8"
# compass插件
require 'autoprefixer-rails'
require 'csso'
# import远程scss文件
require 'remote-sass'
RemoteSass.location = "http://path/to/the/static/root"
@aNd1coder
aNd1coder / _font.scss
Last active December 27, 2015 17:59
@font-face for iconfont
@charset "UTF-8";
$font_name:'iconfont';
$font_url: 'http://path/to/font/#{$font_name}';
@font-face {
font-family: $font_name;
src: url('#{$font_url}.eot');
src: url('#{$font_url}.eot?#iefix') format('embedded-opentype'),
url('#{$font_url}.svg##{$font_name}regular') format('svg'),
@aNd1coder
aNd1coder / radio.scss
Created December 2, 2013 11:07
radio custom style for webkit
input[type='radio'] {
-webkit-appearance: none;
-webkit-user-select: none;
border-radius: 100%;
border: 1px solid #BABABA;
display: inline-block;
height: 16px;
position: relative;
top: 3px;
width: 16px;
@aNd1coder
aNd1coder / _mixins.scss
Last active December 31, 2015 11:59
common sass mixins
@mixin clear {
*zoom: 1;
&:after {
content: '\20';
display: block;
clear: both;
height: 0;
}
}
@aNd1coder
aNd1coder / util.js
Last active August 29, 2015 14:04
javascript utility function
// Add commas to numbers
function addCommas(n) {
return String(n).replace(/(\d)(?=(\d{3})+$)/g, '$1,')
}
//check the browser environment
function isWeiXinEnv(){
var ua = window.navigator.userAgent.toLowerCase();
return ua.match(/MicroMessenger/i) == 'micromessenger';
}
@aNd1coder
aNd1coder / gist:e272a40018f934bed3c2
Created November 24, 2015 02:50 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@aNd1coder
aNd1coder / uninstall_node_npm.sh
Last active December 28, 2017 04:05
Uninstall Node.js completely (Mac OS X)
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/bin/npm
sudo rm -rf ~/.npm
sudo rm -rf ~/.node-gyp
sudo rm -rf /usr/local/share/man/man1/node.1
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
sudo rm -rf /usr/local/lib/node
@aNd1coder
aNd1coder / css_expression_optimize.css
Last active December 5, 2015 05:47
css expression性能优化
/*http://www.cnblogs.com/kaiye/archive/2012/06/06/3039041.html*/
.select2{max-width:200px;*width: expression(function(el){el.style.width = el.offsetWidth > 200 ? '200px' : el.offsetWidth + 'px';counter('2');}(this));}
@aNd1coder
aNd1coder / ssh_key_config.sh
Created December 3, 2015 14:51
配置ssh密钥快速登录远程服务器
# 1.生成密钥
ssh-keygen -t rsa
# 2.拷贝公钥id_rsa.pub到远程服务器的用户.ssh目录下(这里远程服务器是Mac OSX)
scp ~/.ssh/id_rsa.pub {remote_username}@{remote_ip}:~/{remote_username}/.ssh/
# 3.重命名远程服务器上的id_rsa.pub为authorized_keys
mv id_rsa.pub authorized_keys
# 4.编辑本地配置文件