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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("slack.com") { | |
.bot_message { | |
font-size:12px; | |
color: #CCC; | |
} | |
.bot_message .member_image { | |
height: 16px; |
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
{ | |
"browser" : true, | |
"jquery" : true, | |
"devel" : true, | |
"curly" : true, | |
"latedef" : true, | |
"maxdepth" : 3, | |
"newcap" : true, | |
"noarg" : true, | |
"noempty" : true, |
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
> git fetch | |
... | |
error: non-monotonic index .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.idx | |
... | |
> rm .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.idx | |
> git index-pack .git/objects/pack/pack-be03d54c63e1a503114461d4c1945b34c7af01c8.pack |
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
# Simple class to decorate a method and send information MiniProfiler | |
# Usage: CustomMiniProfiler.measure MyClass, :mymethod, "This method takes..." | |
class CustomMiniProfiler | |
def self.measure klass, method, message, class_method=false | |
receptor_class = class_method ? klass.singleton_class : klass | |
receptor_class.send :define_method, "#{method}_with_mini_profiler" do |*args, &block| | |
Rack::MiniProfiler.step(message) do | |
send "#{method}_without_mini_profiler", *args, &block | |
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
# Add these methods to your ApplicationController. Then, any controller | |
# that inherits from it will have these methods and can programmatically | |
# determine what filters it has set. | |
class ApplicationController < ActionController::Base | |
def self.filters(kind = :around) | |
_process_action_callbacks.select{|f| f.kind == kind}.map(&:filter) | |
end | |
def self.before_filters |
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
# This set of classes implement the algorithm described in | |
# > Jia, T., & Barabási, A. L. (2013). | |
# > Control capacity and a random sampling method in exploring controllability of complex networks. | |
# > Scientific reports, 3. | |
# | |
# This algorithm obtains a score for each node of a network telling how 'driver' it is | |
# i.e. What is the chance this node is in a set of nodes that can control the whole network | |
# | |
# Look at the test files to see how to run this algorithm | |
# |
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
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("twitter.com") { | |
# Hiding left sidebar | |
.dashboard.dashboard-left { | |
display: none !important; | |
} | |
# Wider timeline | |
#timeline { |
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
# somewhere in your middleware stack... | |
# request.env['yourapp.someid'] = "1337" | |
YourApp::Application.configure do | |
config.log_tags = [ | |
-> request { | |
request.env['yourapp.someid'] | |
} | |
] | |
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
# This rack engine redirects to external URLs when some error is thrown. | |
# How to use it? | |
# Just add the rack middleware in config/application.rb | |
# require 'rack/error_redirection' | |
# config.app_middleware.insert_before('ActionDispatch::ShowExceptions', 'Rack::ErrorRedirection') | |
# And fill the error_404_url and error500_url variables | |
module Rack | |
class ErrorRedirection | |
def initialize(app) | |
@app = app |
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
* First: Install libxml2 through RVM | |
rvm pkg install libxml2 | |
* Then: Configure libxml in bundle | |
bundle config build.libxml-ruby \ | |
--with-xml2-lib=${HOME}/.rvm/usr/lib \ | |
--with-xml2-include=${HOME}/.rvm/usr/include/libxml2 |