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
Here is a simple jQuery plugin to make a table header fixed on top when window is scrolled. | |
Using the code from twitter bootstrap documentation page, this code is customized for table header. | |
Create the table with following layout - | |
<table class="table-fixed-header"> | |
<thead class="header"> | |
<tr> | |
<th>Column 1</th> | |
<th>Column 2</th> | |
<th>Column 3</th> |
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 'https://rubygems.org' | |
ruby "2.0.0" | |
gem 'rails', '3.2.13' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :production do | |
gem 'rack-google-analytics' |
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
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="robbyrussell" | |
# Example aliases |
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
############### | |
#In Rails 3, we protect attributes that should not be mass assignable by users of the website this way: | |
############### | |
#in the model file: | |
class Post < ActiveRecord::Base | |
attr_accessible :title, :content | |
end | |
#and your controller might look something like that |
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
# Shoulda activemodel cheatsheet | |
# DB | |
should have_db_column(:title).of_type(:string).with_options(default: 'Untitled', null: false) | |
should have_db_index(:email).unique(:true) | |
# Associations | |
should belong_to :company | |
should have_one(:profile).dependent(:destroy) | |
should have_many(:posts).dependent(:nullify) |
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
# The method should be symmetric, i.e., | |
# is_anagram?(word1, word2) == is_anagram?(word2, word1) for any two words | |
is_anagram?('cinema', 'iceman') # => true | |
is_anagram?('iceman', 'cinema') # => true | |
# Pedantically, a word is always an anagram of itself. | |
# This is called being "reflexive," i.e., is_anagram?(word, word) == true for any word | |
is_anagram?('pants', 'pants') # => true | |
# is_anagram? should be case-insensitive |
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
# The dictionary is just an arbitrary collection of strings. | |
# It need not contain English words, e.g., 'etlsm'. | |
dictionary = ['acres', 'cares', 'Cesar', 'races', 'smelt', 'melts', 'etlsm'] | |
# If the input word happens to be in the dictionary, it should be in the the returned array, too. | |
# The list should also be case-insensitive. | |
anagrams_for('acres', dictionary) # => ['acres', 'cares', 'Cesar', 'races'] | |
anagrams_for('ACRES', dictionary) # => ['acres', 'cares', 'Cesar', 'races'] | |
anagrams_for('Cesar', dictionary) # => ['acres', 'cares', 'Cesar', 'races'] |
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
#Table Delegate | |
def tableView(tableView, didSelectRowAtIndexPath: indexPath) | |
tableView.deselectRowAtIndexPath(indexPath, animated: true) | |
# @alert = UIAlertView.alloc.initWithTitle("test", message:"test", delegate:nil, cancelButtonTitle:"Cancel", otherButtonTitles:"Yes").show | |
@alert = UIAlertView.alloc.initWithTitle("Confirm Support Request", message:"A customer service representative will give you a call", delegate: self, cancelButtonTitle: "cancel", otherButtonTitles: "Yes") | |
@alert.show | |
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
call "sip:[email protected]'" | |
say "Tag, you’re it!" |
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
message("hello", {network:"SMS", to: "97158683"}); |
OlderNewer