Skip to content

Instantly share code, notes, and snippets.

View zzz6519003's full-sized avatar
🏀
Trying to Find a Team

Sam Snowman(赵正中) zzz6519003

🏀
Trying to Find a Team
View GitHub Profile
@samqiu
samqiu / railscasts.rb
Last active December 9, 2022 03:49
Download free Railscast video
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@paulmillr
paulmillr / active.md
Last active July 15, 2024 10:55
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@trawor
trawor / isMobileNumber_China
Created September 21, 2012 09:01
isMobileNumber_China.m
- (BOOL)isMobileNumber:(NSString *)mobileNum
{
/**
* 手机号码
* 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
* 联通:130,131,132,152,155,156,185,186
* 电信:133,1349,153,180,189
*/
NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
/**
@MaskRay
MaskRay / gist:4134245
Created November 23, 2012 06:32
Flesch Reading Ease Score of several programming books
% xargs -i sh -c 'echo -n "{} @ "; pdftotext "{}" - 2>/dev/null | ruby -e "require \"lingua\"; p Lingua::EN::Readability.new(STDIN.read).flesch"' < /tmp/books | sort -t@ -k2n
scheme/sicp.pdf @ 42.013863374063305
smalltalk/Joy of Smalltalk.pdf @ 47.861949781603954
falcon/Falcon Survival Guide.pdf @ 52.899363840845155
ruby/The Rails 3 Way.pdf @ 55.05629641057524
c/The C Programming Language.pdf @ 55.17174939358114
python/Learning Python.pdf @ 56.67476157760058
c++/C++ Primer.pdf @ 57.237840064930595
ruby/The Ruby Programming Language.pdf @ 57.75836947304364
haskell/Real World Haskell.pdf @ 58.23158652909788
@wong2
wong2 / README.md
Created January 2, 2013 09:44
模拟登录人人(新)

人人的登录改版后,采用RSA加密后传输密码,该项目用于解决这种情况下人人的模拟登录

使用前先 pip install requests

@vgheri
vgheri / test.js
Last active December 16, 2015 11:49
var should = require('should');
var assert = require('assert');
var request = require('supertest');
var mongoose = require('mongoose');
var winston = require('winston');
var config = require('./config-debug');
describe('Routing', function() {
var url = 'http://someurl.com';
// within before() you can run all the operations that are needed to setup your tests. In this case
@mattt
mattt / UIImageForSwatchOfColorWithSize.h
Created September 27, 2013 01:25
Create a UIImage swatch of a color with a specified size.
static UIImage * UIImageForSwatchOfColorWithSize(UIColor *color, CGSize size) {
UIImage *image = nil;
CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height);
UIGraphicsBeginImageContext(rect.size);
{
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(c, [color CGColor]);
@Kjuly
Kjuly / remove_all_viewdidunload_snippets_from_your_projects_vcs.md
Last active December 24, 2015 03:29
The method -viewDidUnload is deprecated in iOS 6.0. Here offers a way to remove all -viewDidUnload snippets from your project's view controllers in batch.

Remove All -viewDidUnload Snippets From Your Project's VCs

As Apple's Official Doc said:

-viewDidUnload is deprecated in iOS 6.0. Views are no longer purged under low-memory conditions and so this method is never called.

Meanwhile, it's better to remove all -viewDidUnload implements from projects that the deployment target is iOS 6.0 or later. But removing it one by one is boring, especially you've hundreds of controllers & several projects.

So, is there any script or command can do this batch job?

@j67678
j67678 / function.php
Created November 2, 2013 09:51
抓取正方课表
<?php
function str_extract($string,$before,$after){
if(!strpos($string, $before))return false;
$start = strpos($string, $before) + strlen($before);
$string = substr($string, $start);
$end = strpos($string, $after);
return substr($string, 0, $end);
}
function strip_breaks($str){
$str = str_replace('