Skip to content

Instantly share code, notes, and snippets.

View hapiben's full-sized avatar

Ben hapiben

View GitHub Profile
@hapiben
hapiben / secured-ext-components.js
Created March 15, 2012 05:29
Secured ExtJS Components Implementation
/**
* Button - Normal instantiation
*/
var btn = new GepsRelease4AccessControlSecuredButton({
name: 'btn_Sample' // Required property.
,acp: 'Abstract' // Required property. (Access Rights Prefix)
,text: 'Sample'
,iconCls: 'icon-sample'
});
@hapiben
hapiben / capybara_cheat_sheet
Created April 13, 2013 12:35 — forked from zhengjia/capybara cheat sheet
Capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@hapiben
hapiben / folder-sizes.sh
Created July 2, 2014 10:41
Shows a list of folders with size sorted in order
sudo du -x /var/log | sort -n | tail -40
#!/usr/bin/env ruby
# Script to generate PDF cards suitable for planning poker
# from Pivotal Tracker [http://www.pivotaltracker.com/] CSV export.
# Inspired by Bryan Helmkamp's http://github.com/brynary/features2cards/
# Example output: http://img.skitch.com/20100522-d1kkhfu6yub7gpye97ikfuubi2.png
require 'rubygems'
# First attempting to use Capybara directly, you will ran into issues when trying to set HTTP header.
# Using Basic HTTP Authentication requires that we needed to set the header.
# Also we need to set the Content-Type and Accept headers to ensure that Rails handles the input and output correctly.
# When using Rack, Capybara delegates request and response handling down to Rack::Test.
# So I used Rack::Test directly in my step definitions, and it works.
# Rack::Test has a module called Rack::Test::Methods that can be mixed into a class to provide it
# with methods for get, post, put, delete as well as last_request, last_response, header and more.
# I mixed Rack::Test::Methods into the Cucumber world at the top of our API steps file like so:
##############################
@hapiben
hapiben / .bash_profile
Created October 2, 2015 07:25 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
// kills long running ops in MongoDB (taking seconds as an arg to define "long")
// attempts to be a bit safer than killing all by excluding replication related operations
// and only targeting queries as opposed to commands etc.
killLongRunningOps = function(maxSecsRunning) {
currOp = db.currentOp();
for (oper in currOp.inprog) {
op = currOp.inprog[oper-0];
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) {
print("Killing opId: " + op.opid
@hapiben
hapiben / Install Ruby and RubyGems
Created February 24, 2016 01:37 — forked from chiraggude/Install Ruby and RubyGems
Install Ruby 2.1.1 and RubyGems 1.8.25 on CentOS 6.5
# Install Ruby
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
tar xvzf ruby-2.1.1.tar.gz
cd ruby-2.1.1
./configure --prefix=/usr
make
make install
# remove "ruby-2.1.1" folder in /root
@hapiben
hapiben / app.js
Created May 8, 2016 21:02 — forked from benlesh/app.js
Angular - Basics of Unit Testing a Controller
var app = angular.module('myApp', []);
/* Set up a simple controller with a few
* examples of common actions a controller function
* might set up on a $scope. */
app.controller('MainCtrl', function($scope, someService) {
//set some properties
$scope.foo = 'foo';
$scope.bar = 'bar';

Atbash is a simple substitution cipher possible with any known alphabet. It emerged around 500-600 BCE. It works by substituting the letters of an alphabet with another.

English alphabets in order is the constant.

CONSTANT = 'abcdefghijklmnopqrstuvwxyz'

A random shuffle of the constant is the ciper.

Example cipher: zyxwvutsrqponmlkjihgfedcba