Skip to content

Instantly share code, notes, and snippets.

Michael Koper michaelkoper

  • Nusii
  • Madrid
Block or report user

Report or block michaelkoper

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
michaelkoper / gist:5007636
Last active Jan 25, 2018
Handling with money in Mongoid
View gist:5007636
class Product
include Mongoid::Document
field :price, type: Money
Money.class_eval do
# Converts an object of this instance into a database friendly value.
def mongoize
michaelkoper / backbone_pushstate_router.js
Last active Oct 5, 2016 — forked from tbranyen/backbone_pushstate_router.js
hijack links for pushState in Backbone. With open in new tab functionality.
View backbone_pushstate_router.js
// Use absolute URLs to navigate to anything not in your Router.
var openLinkInTab = false;
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
$(document).keydown(function(event) {
if (event.ctrlKey || event.keyCode === 91) {
openLinkInTab = true;
michaelkoper /
Last active Jun 2, 2016 — forked from seyhunak/
Rails - Apache Bench - Load Testing (if Warden Sign-in Required)
curl --cookie-jar cookie_file $LOGIN_PAGE | grep csrf-token
<meta content="csrf-token" name="csrf-token" />
michaelkoper / gist:6668089
Last active Dec 23, 2015
Sublime User Preferences
View gist:6668089
"auto_complete": false,
"auto_match_enabled": false,
"bold_folder_labels": true,
"color_scheme": "Packages/User/railscasts.tmTheme",
michaelkoper / gist:6668097
Last active Dec 23, 2015
Sublime User Keymap
View gist:6668097
{ "keys": ["ctrl+alt+super+d"], "command": "toggle_side_bar" },
{ "keys": ["super+shift+l"], "command": "expand_selection", "args": {"to": "line"} },
{ "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" },
{ "keys": ["super+shift+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["super+shift+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} },
{ "keys": ["command+shift+."], "command": "insert_snippet", "args": {"name": "Packages/User/erb.sublime-snippet"} },
{ "keys": ["ctrl+command+w"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
michaelkoper / gist:4772413
Last active Dec 12, 2015
Some handy media queries for mobile devices
View gist:4772413
@mixin mobile
@media (min-device-width: 320px) and (max-device-width: 568px)
@mixin mobile-portrait
@media (min-device-width: 320px) and (max-device-width: 568px) and (orientation:portrait)
@mixin mobile-landscape
@media (min-device-width: 320px) and (max-device-width: 568px) and (orientation:landscape)
michaelkoper / gist:1605401
Created Jan 13, 2012
No asset debug messages
View gist:1605401
# put in config/initializers/filename.rb
Rails.application.assets.logger ='/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
call_without_quiet_assets(env).tap do
Rails.logger.level = previous_level
michaelkoper / extra_memcached_features.rb
Created Aug 4, 2011
Extra features for memcache store Rails 2.1. Deleting a group of memcached keys.
View extra_memcached_features.rb
module ActiveSupport
module Cache
class MemCacheStore
module Common
KEY = 'all_keys'
# Original method from the memcached store.
# Only difference is that we modify the key so we support Arrays
View gist:debc900aa0c6779e896b
class CarrierStringIO < StringIO
def original_filename
# the real name does not matter
def content_type
You can’t perform that action at this time.