Skip to content

Instantly share code, notes, and snippets.

View spritle's full-sized avatar

Spritle Software spritle

View GitHub Profile
# for more info: https://gist.github.com/1120938
download open ssl for windows: http://www.openssl.org/source/
Reference :
http://www.neilstuff.com/apache/apache2-ssl-windows.htm (for installation)
http://www.napcsweb.com/howto/rails/deployment/RailsWithApacheAndMongrel.pdf (for httpd.conf and ssl.conf & proxy fix)
Sample openssl confi (required to create key file)
@spritle
spritle / parallel_fetch.rb
Last active December 15, 2015 12:39
Fetch data in parallel using Typhoeus Typhoeus took 0.99148906 seconds Httparty took 3.370132528 seconds
require "json"
# option 1
require "typhoeus"
#option 2
require "httparty"
$url1 = "https://api.twitter.com/1/statuses/user_timeline.json?screen_name=dchelimsky&count=2"
@spritle
spritle / capitalize_text.js
Created February 20, 2013 11:38
It is a small and simple plugin which Capitalize all the text inside a table. The plugin also has the option to convert all words to small letters.
(function($) {
$.fn.tableCap = function(params) {
params = $.extend( {lower : false, toggle : true}, params);
var selectedElement = $(this);
toggleText = (function (convert) {
$('tr td',selectedElement).each(function () {
convert($(this).html(), $(this))
});
@spritle
spritle / dabblet.css
Created October 26, 2012 05:27
zig-zag background (SO)
/**
* zig-zag background (SO)
* CSS Zigzag Border with a Textured Background
*/
background: linear-gradient(#EFF0F3 49%, transparent 49%),
linear-gradient(-45deg, white 33%, transparent 33%) 0 50%,
white linear-gradient(45deg, white 33%, #EFF0F3 33%) 0 50%;
background-repeat: repeat-x;
background-size: 1px 100%, 40px 40px, 40px 40px;
@spritle
spritle / scan.rb
Created October 15, 2012 12:50
Scanner Code
#application.rb
# Avoid, the scanner gets auto started when device starts up.
# Avoid, the scanner gets auto started when application start.
def on_activate_app
begin
Scanner.stop
rescue
end
end
#app/layout.erb
@spritle
spritle / redis.rb
Created July 17, 2012 11:32
Redis test
require "redis"
redis = Redis.new(:host => "localhost", :port => 6379)
redis.set "foo", "bar"
redis.get "foo"
@spritle
spritle / from_ipad2_choose_picture_to_webapp
Created October 25, 2011 06:02
Upload image from Rhodes and read exif.gps data using RoR
------------inspect exif_info.exif--------------
[{:orientation=>#<EXIFR::TIFF::Orientation:TopLeft(1)>, :color_space=>1, :pixel_x_dimension=>320,
:pixel_y_dimension=>239}]
-----------inspect exif_info.gps--------------
nil
@spritle
spritle / gist:1042243
Created June 23, 2011 09:35 — forked from otype/gist:137347
Memcached in Ruby
require 'rubygems'
require 'memcache'
class Memcaching
def initialize
@cache = MemCache.new 'localhost:11211', :namespace => 'goofingaroundwithmemcached'
end
def load_key_into_memcache(key,value)
@spritle
spritle / tip1__mechanize_screenscrap.rb
Created April 20, 2010 03:57
mechanize with form login
require 'mechanize'
mechanize_agent = Mechanize.new
# Visit login page
mechanize_agent.get('http://www.cmsimple.org/demo/?Welcome&login') do |page|
remote_login_form = page.form('login')
remote_login_form.passwd = "test"
# Click submit to login
mechanize_agent.submit(remote_login_form, remote_login_form.buttons.first)
# Access the protected page - Settings