def func do
raise "xxx"
end
rescue_from MatchError do
IO.puts "error"
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 'grape/middleware/stack' | |
| module Grape | |
| # An Endpoint is the proxy scope in which all routing | |
| # blocks are executed. In other words, any methods | |
| # on the instance level of this class may be called | |
| # from inside a `get`, `post`, etc. | |
| class Endpoint | |
| include Grape::DSL::Settings | |
| include Grape::DSL::InsideRoute |
params do
requires :a
optional :b
endcompile to
get :path do
IO.puts 1
endcompile to
def route(%Plug.Conn{method: "GET", path_info: ["path"]}, _) do
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
| #-*- coding: utf-8 -*- | |
| set = {} | |
| data = [(100, 200), (100, 300), (100, 400), (100, 500), (400, 600), (700, 500), (800, 800)] | |
| def root(n): | |
| global set | |
| if n not in set: |
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
| # -*- coding: utf-8 -*- | |
| from tornado.options import options | |
| from pyes import ( | |
| ES, | |
| Search, | |
| FilteredQuery, | |
| ANDFilter, | |
| TermFilter, | |
| ORFilter, |
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
| defmodule M1 do | |
| def fun(:arg1) do | |
| IO.puts "arg1" | |
| end | |
| end | |
| defmodule M2 do | |
| def fun(:arg2) do | |
| IO.puts "arg2" | |
| 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
| sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original | |
| # for Mountain Lion 10.8.3 - 10.8.5 | |
| sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage | |
| # for Mountain Lion 10.8.1-10.8.2 and Lion 10.7.5 | |
| #sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage | |
| # for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW | |
| #sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x51)| |