Skip to content

Instantly share code, notes, and snippets.

View benjaminmateev's full-sized avatar

Benjamin Mateev benjaminmateev

View GitHub Profile
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
# vim /etc/sysctl.conf
sunrpc.ve_allow_rpc = 1
fs.nfs.ve_allow_nfs = 1
kernel.ve_allow_kthreads = 1
# sysctl -p
# vzctl stop 101
# vzctl set 101 --features "nfs:on" --save
@benjaminmateev
benjaminmateev / gist:857161
Created March 6, 2011 09:19
Categories Index not working in Magento Admin
app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
<?php
public function getRowUrl($row) {
return $this->getUrl(’*/*/edit’, array(’page_id’ => $row->getId()));
}
?>
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@benjaminmateev
benjaminmateev / gist:1101450
Created July 23, 2011 13:51
Workaround for Debian Bug
tail -f /va-bash: /dev/fd/62: No such file or directory
-bash: /dev/fd/60: No such file or directory
# Workaround:
sudo ln -s /proc/self/fd /dev/fd
@benjaminmateev
benjaminmateev / gist:1125355
Created August 4, 2011 14:55
jQuery UI Autocomplete in Coffeescript
$ ->
$('#header_search').autocomplete
source: "/search/autocomplete"
formatItem: (item) ->
"<img src=\"#{item.url}\" />#{item.title}"
select: (event, ui) ->
location.href = ui.item.href
log_level :info
log_location STDOUT
node_name 'benjaminmateev'
client_key '/Users/benjamenmateev/Sites/xxx/chef/chef-repo/.chef/benjaminmateev.pem'
validation_client_name 'chef-validator'
validation_key '/etc/chef/validation.pem'
chef_server_url 'http://chef.xxx.com:4000'
cache_type 'BasicFile'
cache_options( :path => '/Users/benjamenmateev/Sites/xxx/chef/chef-repo/.chef/checksums' )
@benjaminmateev
benjaminmateev / process_substitution.sh
Last active August 29, 2015 14:22
Process substitution
# Apart from simplicity, another advantage of using process
# substitution is Bash will automatically parallelize your tasks.
diff <(curl http://somesite/file1) <(curl http://somesite/file2)
# Where some-command accepts a filename (or multiple filenames)
# as arguments, and another-command writes output to stdout.
some-command <(another-command)
@benjaminmateev
benjaminmateev / application.rb
Created June 18, 2015 13:47
Default Application.rb
# config/application.rb
# Don't generate assets and helpers
config.generators do |g|
g.assets = false
g.helper = false
end
# Don't include all helpers globally, just the right helper for the current namespace
config.action_controller.include_all_helpers = false