Skip to content
View Evolution of a Python programmer.py
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
View Hash.from_xml
# USAGE: Hash.from_xml(YOUR_XML_STRING)require 'rubygems'
require 'nokogiri'
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#123129
7
class Hash
class << self
def from_xml(xml_io)
begin
result = Nokogiri::XML(xml_io)
View go_live.html.erb
<!-- go_live.html.erb -->
<html>
<head>
<title>Go Live!</title>
<meta name="author" content="Luid M Ruiz">
<!--
http://codepen.io/luismruiz
http://codepen.io/luismruiz/pen/hvgey
http://cdpn.io/hvgey
ported to ERB by @SoAwesomeMan
View ox_parsing.rb
require "awesome_print"
module XmlParsing
require "ox"
class Reader < ::Ox::Sax
def initialize file_path, target, target_handler
@target_handler = target_handler
@target = target
@file_path = file_path
View link-to-via-journey-helper-rails.rb
View image_filters.rb
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
View minimagick-pixel-at-get-hex-color.rb
# get hex color of pixel
# implementation of answer here http://stackoverflow.com/a/8894580/1076207
# solution to MiniMagick::CommandBuilder error in Rails 3.2.x
# config/application.rb
module AwesomeAppName
class Application < Rails::Application
config.after_initialize do
require Rails.root.join('lib', 'gem_ext.rb')
end
View image_resizer.rb
require 'mini_magick'
class ImageResizer
attr_accessor :height, :width, :padding, :stretch, :grayscale
def initialize(path)
@image = MiniMagick::Image.open(path)
end
View favicons-touch-icons-tiles-2014.html
<!--
# This is the answer to my stackoverflow question posted here:
# http://stackoverflow.com/questions/22824947/what-are-all-the-favicon-html-implementations-as-of-2014-cross-browser-inclusi
# (I could not get this posted before it got down-voted and closed)
-->
<!-- Favicon (standard)-->
<!--
# https://github.com/audreyr/favicon-cheat-sheet#ico-file
View favicon.sh
#!/bin/bash
# Favicon and Apple Touch Icon Generator
#
# This bash script takes an image as a parameter, and uses ImageMagick to convert it to several
# other formats used on modern websites. The following copies are generated:
#
# * apple-touch-icon-114x114-precomposed.png
# * apple-touch-icon-57x57-precomposed.png
# * apple-touch-icon-72x72-precomposed.png
Something went wrong with that request. Please try again.