This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git filter-branch -f --env-filter "GIT_AUTHOR_NAME=''; GIT_AUTHOR_EMAIL=''; GIT_COMMITTER_NAME=''; GIT_COMMITTER_EMAIL='';" HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 邮箱 | |
/^(?:[a-z0-9]+[_\-+.]?)*[a-z0-9]+@(?:([a-z0-9]+-?)*[a-z0-9]+.)+([a-z]{2,})+$/i | |
// 手机:13012345678 - 19012345678 | |
/^1[3-9]\d{9}$/ | |
// 座机:02012345678、020-12345678、020 12345678、12345678,1234567 | |
/^(?:((?:0\d{2,3}[- ]?)?[1-9]\d{6,7})|(?:[48]00[- ]?[1-9]\d{6}))$/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(updateDockBadge, 1000) | |
setTimeout(updateDockBadge, 3000) | |
setInterval(updateDockBadge, 5000) | |
function updateDockBadge() { | |
var inboxLink = document.querySelector('a[href*="shva=1#inbox"]') | |
, badge = window.fluid.dockBadge | |
if (inboxLink && inboxLink.href && inboxLink.href.indexOf('mail.google.com') > -1) { | |
var match = inboxLink.title.match(/\((\d+)\)$/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'optparse' | |
require 'fileutils' | |
@options = {} | |
@hosts_path = '/private/etc/hosts' | |
OptionParser.new { |opts| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo lsof -i -P | grep -i "listen" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://docs.angularjs.org/api/ng.$http | |
# | |
# - display loading effect | |
# - do other jobs before request start | |
# - ... | |
angular | |
.module('httpRequestServices', []) | |
.config(['$httpProvider', ($httpProvider) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Base64 Encoder and Decoder shims for client-side. | |
* Based on: https://github.com/dankogai/js-base64/ | |
* | |
* Licensed under the MIT license. | |
* http://opensource.org/licenses/mit-license | |
* | |
* References: | |
* http://en.wikipedia.org/wiki/Base64 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get update | |
echo mysql-server-5.5 mysql-server/root_password password PASSWORD | debconf-set-selections | |
echo mysql-server-5.5 mysql-server/root_password_again password PASSWORD | debconf-set-selections | |
apt-get install -y mysql-common mysql-server mysql-client | |
apt-get install -y apache2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'optparse' | |
require 'fileutils' | |
def get_photo (path) | |
photos = [] | |
if File.directory?(path) then | |
Dir[path + '/*'].each { |path| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var re = /^(\d{4})[-\/\.]{0,1}(?:(?:(11|0?[469])[-\/\.]?([12]\d|30|0?[1-9]))|(?:(1[02]|0?[13578])[-\/\.]{0,1}([1-2]\d|3[01]|0?[1-9]))|(?:(0?2)[-\/\.]{0,1}(2[1-9]|1\d|0?[1-9])))$/; | |
// test | |
[ | |
// valid dates | |
'2012-4-21', | |
'2012-04-21', | |
'2012-5-1', | |
'2012-05-31', | |
'2012-11-21', |