Skip to content

Instantly share code, notes, and snippets.

View birante's full-sized avatar
🎯
Focusing

Birante SY birante

🎯
Focusing
View GitHub Profile
@avsej
avsej / fetch_rubymine_license.rb
Created December 11, 2009 13:32
Automate rubymine license fetching
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'digest/md5'
require 'pp'
begin
require 'faker'
rescue LoadError
puts "You should install faker gem. (gem install faker)"
exit
@pifleo
pifleo / confirmation_instructions.html.haml
Created April 5, 2012 10:12
Rails - Devise i18n mails template fr/en
-# app/views/devise/mailer/confirmation_instructions.html.haml
%p
= t('devise.mailer.welcome', :email => @resource.email)
%p= t('devise.mailer.confirmation_instructions.msg')
%p= link_to t('devise.mailer.confirmation_instructions.link'), confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
@matenia
matenia / post.rb
Created May 10, 2012 01:29
Use custom method for FriendlyId (Example)
class Post < ActiveRecord::Base
# for SO: http://stackoverflow.com/questions/10481389/friendly-id-with-two-parameters
# EXAMPLE ASSUMES YOU ARE USING FRIENDLYID 4.X
# AND THAT YOU HAVE A SLUG:STRING COLUMN ON THE MODEL
# ...
extend FriendlyId
friendly_id :generate_custom_slug, :use => :slugged
# ...
@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.

@pawelztef
pawelztef / _flash.html.erb
Last active August 9, 2021 02:16
rails flash messages with bootstrap 4
<div class="container">
<% flash.each do |type, msg| %>
<div class="alert <%= bootstrap_class_for_flash(type) %> alert-dismissable fade show">
<%= msg %>
<button class="close" data-dismiss="alert">x</button>
</div>
<% end %>
</div>
@mfd
mfd / 06.png
Last active July 15, 2024 02:49
Gilroy font
06.png
@przbadu
przbadu / _vue-rails.md
Last active July 16, 2022 21:48
Vue js and Rails integration

Setup Rails and Vuejs

  1. Generate new rails app using --webpack flag
rails new myApp --webpack=vue

Note:

  1. You can use --webpack=angular for angular application and --webpack=react for react.
@hagemann
hagemann / database.js
Last active December 9, 2022 10:24
Promisified MySQL middleware for Node.js
const util = require('util')
const mysql = require('mysql')
const pool = mysql.createPool({
connectionLimit: 10,
host: 'localhost',
user: 'root',
password: 'password',
database: 'my_database'
})