This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
// font awesome | |
// icon_link_to("Dashboard", internal_path, fa: :dashboard, class: "btn btn-primary") | |
// bootstrap | |
// icon_link_to("Dashboard", internal_path, bs: :home, class: "btn btn-primary") | |
def icon_link_to text, path, options = {} | |
list = block_given? ? yield : "" | |
btn_dropdown = options.delete(:dropdown) ? content_tag(:i, "", class: 'fa fa-angle-left pull-right') : "" | |
if icon = options.delete(:fa) // font-awesome | |
return link_to(content_tag(:i, "", class: 'fa fa-' + icon.to_s) + content_tag(:span, text) + btn_dropdown, path, options) + list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
require 'bcrypt' | |
class User < ActiveRecord::Base | |
PASSWORD_SALT = '$2a$20$ESQ40HbYj00QFse2rbArOe'.freeze | |
PASSWORD_COST = 15.freeze | |
establish_connection adapter: 'sqlite3', database: ':memory:' | |
connection.create_table table_name, force: true do |t| | |
t.string :email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Belajar Git</title> | |
</head> | |
<body> | |
<a href="http://feedburner.google.com/fb/a/mailverify?uri=saiqulhaq&loc=en_US">Subscribe to M. Saiqul Haq Site by Email</a> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
... | |
# FORCE to implement content_for in controller | |
def view_context | |
super.tap do |view| | |
(@_content_for || {}).each do |name,content| | |
view.content_for name, content | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'http://rubygems.org' | |
gem 'rails', '3.1.3' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
# To use ActiveModel has_secure_password | |
# gem 'bcrypt-ruby', '3.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="your_path/holder.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jshint bitwise: false*/ | |
// please take a look at line numbers 80-85, and 172-177 | |
(function(global, document, undefined) { | |
'use strict'; | |
longPoller = function(poll,data){ | |
var gotData = false; | |
var aborted = false; | |
lastAjax = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
filetype off " required! | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle | |
" required! | |
Plugin 'VundleVim/Vundle.vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### General List of Reserved Words | |
### Stuart P. Bentley <stuart@testtrack4.com>, June 4, 2013 | |
## This is a general list of words you may want to consider reserving, | |
## in a system where users can pick any name, in a context where the | |
## system may use names as well. One prominent example of a system | |
## where this is the case would be a site that serves pages for users, | |
## at their username, from the site root, like | |
## http://twitter.com/stuartpb . In this system, you would want to | |
## reserve some routes for pages that would commonly be expected to |
OlderNewer