Skip to content

Instantly share code, notes, and snippets.

View superscott's full-sized avatar
👺
щ(ಠ益ಠщ) (✖╭╮✖) ᕦ(ò_óˇ)ᕤ

superscott superscott

👺
щ(ಠ益ಠщ) (✖╭╮✖) ᕦ(ò_óˇ)ᕤ
View GitHub Profile
<div id="error_page" class="box">
<h1>Ops, 404</h1>
<p>
似乎没有这个页面哦!大哥,去看看别的吧。
</p>
</div>
<!--因为不排除连rails 都无法运行的情况 所以添加 'public/STATUS.htm' 还是很有必要的-->
<!--more>
Finally, the default exceptions application used by Rails that simply renders a page in `public/STATUS.html` is available here: [action_dispatch/middleware/public_exceptions.rb](https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/public_exceptions.rb)
Remember that whatever you do in the errors controller, it should not be anything “fancy”. Keep it simple because something already went wrong with your application!
(function(b, k, l, h) {
var i = function(a, b) {
arguments.length && this._init(a, b)
}, j = 0;
i.prototype = {
defaults: {
mainClass: "pickList",
listContainerClass: "pickList_listContainer",
sourceListContainerClass: "pickList_sourceListContainer",
controlsContainerClass: "pickList_controlsContainer",
@superscott
superscott / pyrag.rb
Created March 7, 2014 22:41
shitty math
n1 = ARGV[0]
n2 = ARGV[1]
e1 = ARGV[2]
e2 = ARGV[3]
n = n1.to_f - n2.to_f
e = e1.to_f - e2.to_f
nn = n * n
ee = e * e
@superscott
superscott / Main.rb
Last active August 29, 2015 13:57
rails email validator?
class Main
validate :email_is_valid
def email_is_valid
vtools = Tools.new
unless vtools.email_valid?(self.email)
logger.error("Invalid Email Domain :: PID: #{$$} EmailDomain: '#{vtools.domain}' ::")
errors.add(:base, "Invalid Email Address.")
end
end
source 'https://rubygems.org'
gem 'rails', '4.0.4'
gem 'mysql2'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'awesome_print', :github => 'michaeldv/awesome_print'
gem 'pry'
desc 'Validating JavaScript with Ant /lib/tasks/js_validate/'
task 'validate:javascript' do
puts 'Validating JavaScript with Ant /lib/tasks/js_validate/'
puts `cd #{Rails.root}/lib/tasks/js_validate/ && ant validate-javascript`
end
@superscott
superscott / keybase.md
Created May 22, 2014 13:38
keybase.md

Keybase proof

I hereby claim:

  • I am superscott on github.
  • I am superscott (https://keybase.io/superscott) on keybase.
  • I have a public key whose fingerprint is 3187 DA2F 5515 23DE 9591 7841 3293 6ED8 5088 25EF

To claim this, I am signing this object:

@cache ||= begin
return true if condition1 && condition2
return true if condition3
return true if condition4
long_code1
long_code2
long_code3
result2
end
@superscott
superscott / curl_output.sh
Last active August 29, 2015 14:05
WPScan Error Output
~/projects/wpscan [13:22:19] [ruby-2.1.2@rails4] $ curl -IkL http://example.com/?author=1
HTTP/1.1 301 Moved Permanently
Content-Length: 157
Content-Type: text/html; charset=UTF-8
Location: http://example.com/author/admin/
Server: Microsoft-IIS/8.0
X-Powered-By: PHP/5.4.23
X-Pingback: http://example.com/xmlrpc.php
X-Powered-By: ASP.NET
Set-Cookie: ARRAffinity=1585cb42abd371ffda100f8cd315354b3b6a2e7476bd3a0acfa838f0a0af0abb;Path=/;Domain=example.com
@superscott
superscott / azure_vm.sh
Last active August 29, 2015 14:05
check if azure vm is running.....
#!/bin/bash
# Pass the vm name as the first argument
vm_name=$1
# Check to make sure the VM is Present (in a silly way).
# data = good, warn = bad.
vm_exist=`azure vm show $vm_name | awk '{print $1}'| uniq | sed 's/://g' | grep warn`
# Default Time Output for Pretty Print.