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 'net/http' | |
| class URI::HTTP | |
| def get(header) | |
| Net::HTTP.start(host, port) do |http| | |
| http.get(request_uri, header) | |
| end | |
| end | |
| end |
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 'zlib' | |
| module Zlib | |
| module_function | |
| def inflate(str) | |
| i = Inflate.new(Zlib::MAX_WBITS + 32) | |
| i.inflate str | |
| end | |
| end |
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
| @ruby -x "%~f0" %* | |
| @exit /b | |
| #!ruby | |
| require 'erb' | |
| if __FILE__ == $0 | |
| abort "usage: #{File.basename $0} [code..]" if ARGV.empty? | |
| files = ARGV.map {|glob| Dir.glob(glob) } | |
| files.flatten! |
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
| #include <windows.h> | |
| #include <stdio.h> | |
| // in ruby: ENV['PATH'] = "#{File.dirname $0}\\lib;#{ENV['PATH']}" | |
| int main(int argc, char **argv) | |
| { | |
| DWORD path_len = GetEnvironmentVariable(TEXT("PATH"), NULL, 0); | |
| char *execpath; | |
| char *last_separator; | |
| TCHAR *path_buf; |
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
| #include <avr/io.h> | |
| // utility macro for DRY bit manipulation | |
| #define ApplyPort(p,n,op) ((p) op _BV(n)) | |
| #define Get(pn) ApplyPort(pn,&) | |
| #define Set(pn) ApplyPort(pn,|=) | |
| #define Clear(pn) ApplyPort(pn,&= ~) | |
| #define NOP() __asm("nop") |
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
| #include <windows.h> | |
| #define EXECUTABLE_PATH "notepad.exe" | |
| int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) | |
| { | |
| PROCESS_INFORMATION p; | |
| STARTUPINFO s; | |
| MSG m; | |
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
| #!ruby -Ks | |
| require 'kconv' | |
| require 'strscan' | |
| class Parser | |
| def initialize(str) | |
| # \201@はSJISでの全角スペース | |
| str = str.gsub("\201@", ' ').gsub(/\/\/.*$/) {|s| ' ' * s.size }.strip | |
| @s = StringScanner.new(str) |
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 'strscan' | |
| class Infer | |
| def self.infer(str) | |
| if str.is_a?(String) | |
| tree = Parser.parse(str_or_tree) | |
| else | |
| tree = str_or_tree | |
| end | |
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
| eval(document.selection.Text) |
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
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
| <profiles version="11"> | |
| <profile kind="CodeFormatterProfile" name="C#-like" version="11"> | |
| <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> | |
| <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> | |
| <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> | |
| <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> | |
| <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> | |
| <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/> | |
| <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> |