Skip to content

Instantly share code, notes, and snippets.

View yetti's full-sized avatar
🔌
Unplugged

Yetrina Battad yetti

🔌
Unplugged
View GitHub Profile
@dcyoung-dev
dcyoung-dev / active_link_to.rb
Last active April 10, 2023 16:54
An `active_link_to` helper that adds the `.active` class and sets `aria-current="page"`
@dakoctba
dakoctba / AppConfig.java
Last active January 22, 2024 11:58
Spring Boot + JDBI + Multiple Databases
import java.util.List;
import javax.sql.DataSource;
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.mapper.RowMapper;
import org.jdbi.v3.core.spi.JdbiPlugin;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
@O-I
O-I / extract_uri.md
Last active August 19, 2023 01:02
[TIx 3] Extracting links from text with URI::extract

I have a simple Rails app that collects all the tweets I favorite on Twitter so I can sort and search through them at my leisure. Many of those favorites contain links I'd like to refer to, so I wrote a helper method that converts them to clickable anchor tags that looked like this:

# app/helpers/favorites_helper.rb
module FavoritesHelper

  # snip
  
  def text_to_true_link(tweet_text)
 urls = tweet_text.scan(/https*:\/\/t.co\/\w+/)
@boyvanamstel
boyvanamstel / gist:4730804
Last active December 12, 2015 06:39
Add an active state to your Octopress menu items
# This is the Danger Cove Active Menu plugin
#
# Installation:
# Place this file in your plugin directory.
#
# Usage:
# class="{% dcactivemenu checkfor.html [/another] %}"
#
# Returns 'active' when the checkfor.html occurs in the page.url
#
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@necolas
necolas / contain-floats.css
Created April 22, 2011 00:36
Cross-browser, consistent float-containment methods
/*
* Containing floats in a consistent manner
* By Jonathan Neal and Nicolas Gallagher
*/
/*
* New block formatting context method
* IE 6+, Firefox 2+, Safari 4+, Opera 9+, Chrome
*/