Skip to content

Instantly share code, notes, and snippets.

View CelsoDeSa's full-sized avatar
🏠
Working from home

Celso de Sá CelsoDeSa

🏠
Working from home
View GitHub Profile
@kuboon
kuboon / application_helper.rb
Created July 26, 2012 08:15
glyph icon helper for twitter-bootstrap with Rails
module ApplicationHelper
# ==== Examples
# glyph(:share_alt)
# # => <i class="icon-share-alt"></i>
# glyph(:lock, :white)
# # => <i class="icon-lock icon-white"></i>
def glyph(*names)
content_tag :i, nil, class: names.map{|name| "icon-#{name.to_s.gsub('_','-')}" }
end
@mokagio
mokagio / sticky.css
Created February 26, 2012 20:53
Twitter Bootstrap + Sticky Footer + Fixed Nav Bar
html, body, .container, .content {
height: 100%;
}
.container, .content {
position: relative;
}
.proper-content {
padding-top: 40px; /* >= navbar height */
@albertosaurus
albertosaurus / transaction_trick.rb
Last active November 22, 2021 17:12
Rails programming trick - macro to wrap a method call in a transaction
module WithTransaction
extend ActiveSupport::Concern
module ClassMethods
# Wrap the given method in a transaction.
def with_transaction(method_name)
define_method "#{method_name}_with_transaction" do |*args, &block|
@dudo
dudo / intrumentation.rb
Last active February 22, 2022 20:32
Tracing via a macro
module Instrumentation
DEFAULT_OPERATION = 'method.execution'
def self.trace(operation: DEFAULT_OPERATION, resource:, **options)
options.merge!(resource: resource).compact!
Datadog.tracer.trace(operation, options) do |span|
Datadog::Analytics.set_measured(span)
yield
end
rescue StandardError
@aarongustafson
aarongustafson / responsive-iframes.css
Created October 25, 2011 17:07
Responsive iFrames with jQuery
iframe {
max-width: 100%;
}
@henrik
henrik / README.markdown
Created June 26, 2012 07:30
This is how we test that all translation keys match up between locales, in Rails.

This is how we test that all translation keys match up between locales.

Stuff that only goes in one locale (such as an admin section) or that can't be translated yet (if you use external translators) can simply go in files that don't match the path "config/locales/??.yml", like "config/locales/wip.fo.yml".

@xxlukas42
xxlukas42 / eink_demo.ino
Created March 31, 2019 20:47
MH-ET LIVE 1.54-inches E-Paper demo
#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>
#include <Fonts/OpenSansBold12pt7b.h>
#include <Fonts/OpenSansBold14pt7b.h>
#include <Fonts/OpenSansBold30pt7b.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include GxEPD_BitmapExamples
@navinpai
navinpai / README
Created June 9, 2012 19:18
Simple CSS Blinking Cursor
Simple blinking cursor... code from http://xip.io/ ... Ofcourse I don't own the code! Just keeping it here as a reference of the CSS3 code used.
@derhuerst
derhuerst / intro.md
Last active May 13, 2023 17:56
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows

Installing zsh – the easy way

The Z shell (zsh) is a Unix shell [...]. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh.

Z shell – Wikipedia

Read more about ZSH at An Introduction to the Z Shell.

Choose one of the following options.

@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)