This file contains hidden or 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
| #!/bin/bash | |
| rm -rf api.rubyonrails.org/ | |
| wget -r -k -p http://api.rubyonrails.org/ | |
| rm rails_api.rar | |
| rar a -r rails_api.rar api.rubyonrails.org/ |
This file contains hidden or 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
| # Allows `nil` to compare to String,Numeric,NilClass.So you can sort a array if it include nil. | |
| # | |
| # nil <=> '' # => 0 | |
| # nil <=> 'Tom' # => -1 | |
| # nil == '' # false | |
| # For the NilClass the method == do not depond on the <=>. | |
| # | |
| # '' <=> nil # => 0 | |
| # 'Tom' <=> nil # => 1 | |
| # '' > nil # => false |
This file contains hidden or 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
| # File activesupport/lib/active_support/core_ext/module/aliasing.rb, line 23 | |
| def alias_method_chain(target, feature) | |
| # Strip out punctuation on predicates or bang methods since | |
| # e.g. target?_without_feature is not a valid method name. | |
| aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1 | |
| yield(aliased_target, punctuation) if block_given? | |
| with_method = "#{aliased_target}_with_#{feature}#{punctuation}" | |
| without_method = "#{aliased_target}_without_#{feature}#{punctuation}" |
This file contains hidden or 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
| # once/once.rb: Written by Tadayoshi Funaba 1998,2000,2002,2006,2008 | |
| # $Id: once.rb,v 1.2 2008-11-12 19:58:01+09 tadf Exp $ | |
| module Once | |
| def once(*ids) | |
| for id in ids | |
| module_eval <<-"end;" | |
| alias_method :__#{id.object_id}__, :#{id.to_s} | |
| def #{id.to_s}(*args, &block) |
This file contains hidden or 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
| svn st | grep ! | cut -c 9- | while read line;do svn resolved $line;done |
This file contains hidden or 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
| #!/bin/sh | |
| list_alldir(){ | |
| for file2 in `ls -a $1` | |
| do | |
| if [ x"$file2" != x"." -a x"$file2" != x".." ];then | |
| if [ -d "$1/$file2" ] && (echo $file2 | grep -qv '.svn');then | |
| list_alldir "$1/$file2" | |
| elif (echo $1/$file2 | egrep -q '(de|el|fr|it)\.yml$');then | |
| echo "$1/$file2" | |
| rm $1/$file2 |
This file contains hidden or 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
| int c; | |
| char *hex = "0123456789abcdef"; | |
| while( (c = getchar()) != EOF ){ | |
| if( ('a' <= c && c <= 'z') | |
| || ('A' <= c && c <= 'Z') | |
| || ('0' <= c && c <= '9') ){ | |
| putchar(c); | |
| } else { | |
| putchar('%'); |
This file contains hidden or 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
| def self.total_grouped_by(date_part) | |
| case date_part | |
| when 'day' | |
| downloads = self.joins(:app_version).group("EXTRACT(YEAR from downloads.created_at),DATE(downloads.created_at),app_versions.name") | |
| downloads = downloads.order("max(EXTRACT(YEAR from downloads.created_at)) desc,max(DATE(downloads.created_at)) desc,max(app_versions.name)") | |
| downloads = downloads.select("EXTRACT(YEAR from downloads.created_at) as created_year,DATE(downloads.created_at) as created_part, app_versions.name as app_name, count(downloads.id) as total") | |
| when 'week' | |
| downloads = self.joins(:app_version).group("EXTRACT(ISOYEAR from downloads.created_at),EXTRACT(#{date_part} from downloads.created_at),app_versions.name") | |
| downloads = downloads.order("max(EXTRACT(ISOYEAR from downloads.created_at)) desc,max(EXTRACT(#{date_part} from downloads.created_at)) desc,max(app_versions.name)") | |
| downloads = downloads.select("EXTRACT(ISOYEAR from downloads.created_at) as created_year,EXTRACT(#{date_part} from |
This file contains hidden or 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
| require 'active_support/core_ext/object/to_param' | |
| class Object | |
| # Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the | |
| # param name. | |
| # | |
| # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work. | |
| def to_query(key) | |
| require 'cgi' unless defined?(CGI) && defined?(CGI::escape) | |
| "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}" |
This file contains hidden or 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
| server { | |
| listen 80; | |
| server_name xxxxxxxxxxx; | |
| access_log /var/log/nginx/nagios.access.log; | |
| error_log /var/log/nginx/nagios.error.log info; | |
| expires 31d; | |
| root /usr/share/nagios3/htdocs; |
OlderNewer