iht.li 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/iht.li.rb +66 -0
  2. metadata +64 -0
@@ -0,0 +1,66 @@
1
+ #--
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # Copyleft shura [shura1991@gmail.com]
6
+ #
7
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
8
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
9
+ #
10
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
11
+ #++
12
+
13
+ require 'net/http'
14
+
15
+ module IHT
16
+ def self.li
17
+ ::IHT::LI
18
+ end
19
+
20
+ module LI
21
+ LANGUAGES = ['text', 'abap', 'actionscript', 'ada', 'apache', 'applescript',
22
+ 'asm', 'asp', 'autoit', 'bash', 'basic4gl', 'bf', 'blitzbasic', 'bnf',
23
+ 'c', 'c_mac', 'caddcl', 'cadlisp', 'cfdg', 'cfm', 'cil', 'cobol', 'cpp-qt',
24
+ 'cpp', 'csharp', 'css', 'd', 'delphi', 'diff', 'div', 'dos', 'dot',
25
+ 'eiffel', 'fortran', 'freebasic', 'genero', 'gettext', 'glsl', 'gml',
26
+ 'gnuplot', 'groovy', 'haskell', 'hq9plus', 'html4strict', 'idl', 'ini',
27
+ 'inno', 'intercal', 'io', 'java', 'java5', 'javascript', 'kixtart',
28
+ 'klonec', 'klonecpp', 'latex', 'lisp', 'lolcode', 'lotusscript', 'lua',
29
+ 'm68k', 'make', 'matlab', 'mirc', 'mxml', 'mpasm', 'mysql', 'nsis', 'objc',
30
+ 'ocaml-brief', 'ocaml', 'oobas', 'oracle8', 'oracle11', 'pascal', 'per',
31
+ 'perl', 'php-brief', 'php', 'pixelbender', 'plsql', 'povray', 'powershell',
32
+ 'progress', 'prolog', 'providex', 'python', 'qbasic', 'rails', 'reg',
33
+ 'robots', 'ruby', 'sas', 'scala', 'scheme', 'scilab', 'sdlbasic',
34
+ 'smalltalk', 'smarty', 'sql', 'tcl', 'teraterm', 'thinbasic', 'tsql',
35
+ 'typoscript', 'vb', 'vbnet', 'verilog', 'vhdl', 'vim', 'visualfoxpro',
36
+ 'visualprolog', 'whitespace', 'winbatch', 'xml', 'xorg_conf', 'xpp', 'z80']
37
+
38
+ def self.shorter(url)
39
+ Net::HTTP.post_form(URI.parse('http://iht.li/add_url.php'), {'url' => url}).body.strip
40
+ end
41
+
42
+ def self.nopaste(text, lang='text', author='NoBody', title='NoTitle', password=nil)
43
+ raise 'Language doesn\'t exist' unless LANGUAGES.include?(lang)
44
+
45
+ params = {
46
+ 'text' => text,
47
+ 'language' => lang,
48
+ 'author' => author,
49
+ 'title' => title,
50
+ 'private' => '0',
51
+ 'password' => ''
52
+ }
53
+
54
+ if password
55
+ params['private'] = '1'
56
+ params['password'] = password
57
+ end
58
+
59
+ Net::HTTP.post_form(URI.parse('http://iht.li/add_paste.php'), params).body.strip
60
+ end
61
+ end
62
+ end
63
+
64
+ def iht
65
+ ::IHT
66
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iht.li
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - shura
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-10-06 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: iht.li shorter and nopaste lib
22
+ email: shura1991@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/iht.li.rb
31
+ has_rdoc: true
32
+ homepage: http://github.com/shurizzle/iht.li
33
+ licenses: []
34
+
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.7
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: iht.li shorter and nopaste lib
63
+ test_files: []
64
+