Skip to content

Instantly share code, notes, and snippets.

View morristech's full-sized avatar
🔴
"What I cannot create, I do not understand"

Wade morristech

🔴
"What I cannot create, I do not understand"
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active June 13, 2025 16:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@bgreenlee
bgreenlee / report.rb
Created March 1, 2009 06:01
Displays a mysql-style report for an array of ActiveRecord objects. Stick it in your .irbrc.
# mysql-style output for an array of ActiveRecord objects
#
# Usage:
# report(records) # displays report with all fields
# report(records, :field1, :field2, ...) # displays report with given fields
#
# Example:
# >> report(records, :id, :amount, :created_at)
# +------+-----------+--------------------------------+
# | id | amount | created_at |
@kennethkalmer
kennethkalmer / scrap-tui.rb
Created April 16, 2009 14:47
Automate scrap testing your Rails app
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
puts "Memory Usage Delta "
puts "============ ========"
loop do
agent.get('http://172.16.133.100:3000/session/new')
@flavorjones
flavorjones / README.markdown
Created August 19, 2009 05:46
Comparison of Loofah against other Ruby HTML sanitization libraries

Overview of the Benchmark

The following benchmark output was generated from the codes at http://github.com/flavorjones/loofah/tree/master/benchmark

These results show the performance of Loofah scrubbing methods against comparable methods from other common open-source libraries:

  • ActionView sanitize() and strip_tags()
  • Sanitize sanitize()
# SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy
#
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin.
@blankdots
blankdots / test.php
Created October 16, 2009 20:09
CodeIgniter Demo
/**
Distributed under the MIT License :
Copyright (c) 2009 <http://blankdots.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
@blankdots
blankdots / inde_view.php
Created October 16, 2009 20:10
CodeIgniter Demo
<!--
Distributed under the MIT License :
Copyright (c) 2009 <http://blankdots.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/usr/bin/perl
# A simple web server that just listens for textarea filter requests
# and runs an editor to manipulate the text. Is intended to be
# used with the TextAid extention for Chrome.
use strict;
use warnings;
use threads;
use threads::shared;
use Socket;
package com.tokudu.begemot.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.CheckedTextView;
import android.widget.LinearLayout;
/*
@pjlantz
pjlantz / Dynamic module load
Created June 2, 2010 14:49
POC on dynamic module loading
# moduleManager.py
modules = {}
def register(module):
"""
Decorator to be used for registering a function belonging to a module that
handles the configuration for that module
"""
def registered_module(funct):
if module in modules: