Skip to content

Instantly share code, notes, and snippets.

View unimatrixZxero's full-sized avatar
🌱
💎

Sam Figueroa unimatrixZxero

🌱
💎
View GitHub Profile
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
<!DOCTYPE html>
<html>
<head>
<script src="https://raw.github.com/LearnBoost/Socket.IO/master/socket.io.js"></script>
<script src="https://raw.github.com/documentcloud/underscore/master/underscore.js"></script>
<script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
</head>
<body>
<form id="connect">
Nick: <input type="text">
@belt
belt / query_trace.rb
Created August 10, 2011 16:33
QueryTrace... ported to rails3
require 'term/ansicolor'
# yeilds a stacktrace for each SQL query
# put this file in config/initializers
class QueryTrace < ActiveSupport::LogSubscriber
include Term::ANSIColor
attr_accessor :trace_queries
def sql(event) #:nodoc:
return unless QueryTrace.enabled? && logger.debug? && Rails.env.development?
module Jekyll
class Pagination < Generator
# This generator is safe from arbitrary code execution.
safe true
# Generate paginated pages if necessary.
#
# site - The Site.
#
@mattheworiordan
mattheworiordan / Gemfile
Created September 7, 2011 12:06
Test PDF within Cucumber and Capybara
# normal Gem dependancy declarations
# ...
group :test, :cucumber do
gem 'pdf-reader'
end
@davist11
davist11 / gist:1204569
Last active January 19, 2024 15:03
Campfire sounds
56k: "https://123.campfirenow.com/images/56k.gif"
bell: ":bell:"
bezos: ":laughing::thought_balloon:"
bueller: "anyone?"
butts: ":open_hands: :smoking:"
clowntown: "https://123.campfirenow.com/images/clowntown.gif"
cottoneyejoe: ":notes::hear_no_evil::notes:"
crickets: "hears crickets chirping"
dadgummit: "dad gummit!! :fishing_pole_and_fish:"
dangerzone: "https://123.campfirenow.com/images/dangerzone.png"
@ralph
ralph / github-flavored-markdown.rb
Created October 20, 2011 11:39
Markdown Processor for Redcarpet version 2, for usage on the command line, in Marked etc. Supports syntax highlighting via Pygments.
#!/usr/bin/env ruby
# Processor for Github flavored markdown, inspired by:
# https://github.com/alampros/Docter/blob/master/bin/github-flavored-markdown.rb
#
# Current version of this script can be found here:
# https://gist.github.com/1300939
#
# Adapted for Redcarpet version 2 by Ralph von der Heyden
# http://github.com/ralph
# http://twitter.com/ralph
@Overbryd
Overbryd / sqlite2sql.sh
Created October 25, 2011 11:20
Quickly create a sql dump from a sqlite3 file
#!/bin/bash
sqlite3 $1 .dump | sed -e '/sqlite_sequence/d' \
-e '/PRAGMA/d' \
-e '/BEGIN TRANSACTION/d' \
-e '/COMMIT/d' \
-e 's/"/`/g'
@mschae
mschae / frowl.rb
Created November 14, 2011 17:03
Fritz.Box Anrufmonitor
# Requires the following gems:
# - prowler (v. 1.2)
# - gdata
# Also requires prowl on your iPhone
# As always: Feel free to use as is, I'm not responsible for anything
prowl_api_key = ""
fritz_box_host = ""
google = {
:user => "",
@bkimble
bkimble / gist:1365005
Last active May 2, 2024 01:27
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []