Skip to content

Instantly share code, notes, and snippets.

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

Saiqul Haq saiqulhaq

🏠
Working from home
View GitHub Profile
<!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&amp;loc=en_US">Subscribe to M. Saiqul Haq Site by Email</a>
</body>
</html>
@saiqulhaq
saiqulhaq / build-zsh.sh
Created November 30, 2012 01:59 — forked from nicoulaj/build-zsh.sh
Build Zsh from sources on Ubuntu
#!/bin/sh​
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
git clone git://zsh.git.sf.net/gitroot/zsh/zsh
cd zsh

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@saiqulhaq
saiqulhaq / latest-tmux-1.7 on ubuntu12.04
Last active October 29, 2022 21:12
Install latest tmux on ubuntu 12.04
sudo apt-get build-dep tmux
git clone git://tmux.git.sourceforge.net/gitroot/tmux/tmux tmux
cd tmux
./autogen.sh
./configure --prefix=/usr/local
make
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
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'
<script src="your_path/holder.js"></script>
@saiqulhaq
saiqulhaq / gist:b8573273e1c1d584cabd
Created December 20, 2014 16:22
rails icon_link_to helper
// 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
@saiqulhaq
saiqulhaq / rspec_model_testing_template.rb
Last active August 29, 2015 14:20 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# 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:
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