Skip to content

Instantly share code, notes, and snippets.

Sven Pachnit 2called-chaos

Block or report user

Report or block 2called-chaos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@2called-chaos
2called-chaos / z_airbrake.rb
Created Apr 17, 2018
Airbrake 6.3 config
View z_airbrake.rb
Airbrake.configure do |config|
# project specific
config.project_key = ''
# use git SHA & current commit as app version
config.app_version = "Ruby: #{RUBY_VERSION} » Rails: #{Rails::VERSION::STRING} » " << `cd #{Rails.root} && git log -1 --pretty="%h - %B" HEAD`
# can always be 1
config.project_id = 1
@2called-chaos
2called-chaos / srcds_log.rb
Last active Sep 15, 2016
Log filterer/colorizer/analyzer for source servers (CS:GO + sourcemod tested only)
View page_sketch.coffee
window.PageSketch =
init: ->
@opened = false
@redo_buffer = []
# custom sketch close link
@getCloseLink().click (ev) =>
@toggleSketch()
return false
@2called-chaos
2called-chaos / profile.sh
Created Mar 16, 2016
binstubs light (hack)
View profile.sh
# binstubs light
function bundle_exec {
bundler=`bundle list 2>&1`
cmd=$1
shift
if [[ $bundler == "" || $bundler =~ "Could not locate Gemfile" ]]
then
command="$cmd $@"
else
View rails_resource_routing.rb
/* ====================== */
/* = resources :baskets = */
/* ====================== */
butler_baskets GET /butler/baskets(.:format) {:action=>"index", :controller=>"butler/baskets"}
POST /butler/baskets(.:format) {:action=>"create", :controller=>"butler/baskets"}
new_butler_basket GET /butler/baskets/new(.:format) {:action=>"new", :controller=>"butler/baskets"}
edit_butler_basket GET /butler/baskets/:id/edit(.:format) {:action=>"edit", :controller=>"butler/baskets"}
butler_basket GET /butler/baskets/:id(.:format) {:action=>"show", :controller=>"butler/baskets"}
PUT /butler/baskets/:id(.:format) {:action=>"update", :controller=>"butler/baskets"}
DELETE /butler/baskets/:id(.:format) {:action=>"destroy", :controller=>"butler/baskets"}
View call_method_like_proc.rb
module Banana
# Provides low level support functionalities.
module Kernel
# Calls a method with the maximum possible amount of arguments.
#
# Ruby's arity telling is too inaccurate so we just try to call the method
# with everything we have and if this raises an ArgumentError we examine the
# maximum allowed amount of arguments and pass those.
#
# Dont believe me?
View html_with_pygments.rb
# create a custom renderer that allows highlighting of code blocks
class HTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
if language.to_s.end_with?("CHL")
language = language[0...-3]
code = Pygments.highlight(code, lexer: language, options: { linespans: Digest::SHA1.base64digest(code) })
code = code.gsub(/<span class="(?:[a-z]+)">==<\/span>(.*?)<span class="(?:[a-z]+)">==<\/span>/, %{<span class="highlight">\\1</span>}.html_safe)
else
Pygments.highlight(code, lexer: language, options: { linespans: Digest::SHA1.base64digest(code) })
end
View content_renderer.rb
require "shellwords"
class ContentRenderer
def initialize str, opts
@str = str.dup
@opts = opts.reverse_merge markdown: true, youtube: true
end
def to_str
@_rendered ||= @opts.inject(@str) do |text, (opt, perform)|
View sidekiq.log
2013-07-27T05:13:40Z 1610 TID-fo9os PostReceive JID- INFO: done: 0.03 sec
2013-07-27T05:24:10Z 1610 TID-jghnk PostReceive JID- INFO: start
2013-07-27T05:24:10Z 1610 TID-jghnk PostReceive JID- INFO: done: 0.032 sec
2013-07-27T05:29:34Z 1610 TID-fo9os PostReceive JID- INFO: start
2013-07-27T05:29:34Z 1610 TID-fo9os PostReceive JID- INFO: done: 0.028 sec
2013-07-27T05:35:19Z 1610 TID-jghnk PostReceive JID- INFO: start
2013-07-27T05:35:19Z 1610 TID-jghnk PostReceive JID- INFO: done: 0.029 sec
2013-07-27T05:37:58Z 1610 TID-fo9os PostReceive JID- INFO: start
2013-07-27T05:37:58Z 1610 TID-fo9os PostReceive JID- INFO: done: 0.03 sec
2013-07-27T05:39:39Z 1610 TID-jghnk PostReceive JID- INFO: start
View request.xml
<?xml version="1.0" encoding="UTF-8"?>
<notice version="2.0">
<api-key>4c34e088c66a4460b88a8a2159cb5003</api-key>
<notifier>
<name>airbrake_js</name>
<version>0.2.0</version>
<url>http://airbrake.io</url>
</notifier>
<error>
<class>Error</class>
You can’t perform that action at this time.