Skip to content

Instantly share code, notes, and snippets.

View mdamaceno's full-sized avatar
🇧🇷

Marco Damaceno mdamaceno

🇧🇷
View GitHub Profile
@bosunolanrewaju
bosunolanrewaju / test.retry.php
Last active May 9, 2022 17:21 — forked from mudge/test.retry.php
A retry function for PHP.
<?php
require_once dirname(__FILE__) . '/../lib/simpletest/autorun.php';
// Retries $f (A function) with arguments ($args as array)
// 3 ($retries) times after 10 secs $delay
// Usage:
// retry( 'function_name', array('arg1', 'arg2'), 15, 5 );
// #=> Retries function_name 5 times with arg1 and $arg2 as arguments at interval of 15 secs
function retry($f, $args = null, $delay = 10, $retries = 3)
{
@theCrab
theCrab / authentication.rb
Last active April 27, 2022 15:42
A Hanami Framework authentication based on JSON Web Tokens.
# lib/authentications/authentication.rb
# @api auth
# Authentication base class
#
module Authentication
def self.included(base)
base.class_eval do
before :authenticate!
expose :current_user
@floodedcodeboy
floodedcodeboy / default.conf
Created June 6, 2015 23:17
nginx magento subfolder config
## lifted shamelessly from http://stackoverflow.com/questions/19142004/nginx-magento-in-subfolder
server {
listen 80;
listen 443;
server_name www.domain.de domain.de *.domain.de;
root /var/www/domain.de/www.domain.de/htdocs;
index index.php;
access_log /var/log/nginx/domain_access.log;
error_log /var/log/nginx/domain_error.log;
@anotheruiguy
anotheruiguy / web-fonts-asset-pipeline.md
Last active June 24, 2024 22:11
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.