Skip to content

Instantly share code, notes, and snippets.

View tanduong's full-sized avatar

Tan Duong tanduong

View GitHub Profile
# turn on webkit driver debug
$webkit_debug = false
$wait_time = 5
$use_chrome_instead_of_firefox = true
def set_webkit_driver()
if $webkit_debug
Capybara.javascript_driver = :webkit_debug
else
Capybara.javascript_driver = :webkit
var Dropdown;
Dropdown = (function() {
function Dropdown($el, options) {
this.options = options;
this.$el = $el;
this.setup()
};
Dropdown.prototype.defaults = {
@tanduong
tanduong / Shortcuts
Last active August 29, 2015 14:22
Shortcuts
Tmux
=================
Create new session
tmux new -s <session name>
Suspend session:
Ctrl + b + z
Attach session:
<html ng-app="buttons">
<div button-group>
<div button-main>
<div>Main</div>
</div>
<div button-item>
<div>Item 1</div>
</div>
<div button-item>
<div>Item 2</div>
@tanduong
tanduong / gpyWWz.markdown
Last active August 29, 2015 14:27
gpyWWz
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/jasmine-html.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.3.4/boot.min.js"></script>
@tanduong
tanduong / debouncerequestqueue.markdown
Created September 16, 2016 15:18
DebounceRequestQueue
@tanduong
tanduong / convert sass to scss
Created October 19, 2016 16:22 — forked from pedrogpimenta/convert sass to scss
Convert SASS to SCSS and delete .sass files (applies to all files in current folder)
sass-convert -R ./ -F sass -T scss && rm *.sass
@tanduong
tanduong / index.html
Created December 22, 2016 07:44
magnify effect
<!-- Lets make a simple image magnifier -->
<div class="magnify">
<!-- This is the magnifying glass which will contain the original/large version -->
<!-- This is the small image -->
<img class="small" src="http://thecodeplayer.com/uploads/media/iphone.jpg" width="200"/>
<div class="large"></div>
</div>

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application