Skip to content

Instantly share code, notes, and snippets.

@endorfin
endorfin / routes_js.rb
Created December 29, 2010 18:17 — forked from kossnocorp/routes_js.rb
RUBY: RoutesJs
#
# Rails 3 Version
# - ported to rails3
# - optimize javascript
#
# setup/usage:
# 1. copy to RAILS_ROOT/app/middleware/
# 2. application.rb ... config.middleware.use 'RoutesJs'
# 3. Layoutfile: <%= javascript_include_tag 'routes' %>
# 4. js usage: category_url({ slug:'test',format:'json', page:2 })
@endorfin
endorfin / PixelCarousel.js
Created December 11, 2011 20:18
JS: Simple Infinite Carousel - jQuery Version
/*
* Simple Infinite Carousel - jQuery Version
*
* Released on 11th December 2011.
*
* Copyright (c) 2010-2011 René Kersten, http://pixel-webarts.de
*
* Licensed under the terms of MIT License.
*
*/
@endorfin
endorfin / PixelMosaic.js
Created December 21, 2011 20:51
JS: Mosaic Photo Wall - jQuery Version
/*
* Mosaic - jQuery Version
*
* Released on 21th December 2011.
*
* Copyright (c) 2010-2011 René Kersten, http://pixel-webarts.de
*
* Licensed under the terms of MIT License.
*
*/
@endorfin
endorfin / yamllint.sh
Created April 20, 2012 19:49
BASH: Find/Validate YAML File with YAHLLint.com from Command Line
# found at http://pastebin.com/9aW75CUi
for i in $(find config -name '*yml'); do curl --data-urlencode yaml'@'$i -d utf8='%E2%9C%93' -d commit=Go http://yamllint.com/ --trace-ascii out -G 2>&1 | egrep 'div.*background-color'; done
#OR
for i in $(find config -name '*yml')
do
curl --data-urlencode yaml'@'$i -d utf8='%E2%9C%93' -d commit=Go http://yamllint.com/ --trace-ascii out -G 2>&1 | egrep 'div.*background-color'
@endorfin
endorfin / rbenv-install-system-wide.sh
Created September 17, 2012 10:09 — forked from jnx/rbenv-install-system-wide.sh
SERVER: rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@endorfin
endorfin / gplus2twitter.rb
Created June 19, 2013 13:37
15min ruby script to post googleplus 2 twitter
require 'rubygems'
require 'fileutils'
require 'feedzirra'
require 'googl'
require 'twitter'
# twitter
Twitter.configure do |config|
config.consumer_key = CONSUMER_KEY
config.consumer_secret = CONSUMER_SECRET
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core libssl-dev
# Install rbenv
RBENV_ROOT=/opt/rbenv
git clone https://github.com/sstephenson/rbenv.git $RBENV_ROOT
@endorfin
endorfin / gist:e23d8b908525e2fb1b0d
Created September 13, 2014 08:11
Prevent browser's default functionality when dropping file outside of a drop zone
$(document).bind('drop dragover', function (e) {
e.preventDefault();
});
@endorfin
endorfin / snmp.rb
Created March 13, 2016 13:21 — forked from drolfe/snmp.rb
Ruby Snmp Interface Bandwidth
#!/usr/bin/ruby
require 'rubygems'
require 'snmp'
include SNMP
@results = Array.new
# Interface speed in mbps
interface_speed = 10000
def get_snmp