Skip to content

Instantly share code, notes, and snippets.

View jaunesarmiento's full-sized avatar

Jaune Carlo Sarmiento jaunesarmiento

View GitHub Profile
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@jaunesarmiento
jaunesarmiento / reset_to_commit.sh
Created September 4, 2013 18:57
Step-by-step process to revert to a previous commit using its SHA hash
# reset the index to the desired tree
git reset 56e05fced
# move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Update working copy to reflect the new commit
git reset --hard
@jaunesarmiento
jaunesarmiento / toggle_shell_from_vim.sh
Created September 12, 2013 16:18
Toggle shell from vim
# exit vim temporarily
ctrl + z
# go back to vim
$ fg
@jaunesarmiento
jaunesarmiento / my_table_view_controller.rb
Last active December 28, 2015 05:59
UITableViewController required delegate methods
class MyTableViewController < UITableViewController
attr_accessor :datasource
def numberOfSectionsInTableView(table_view)
# Usually just 1
1
end
def tableView(table_view, numberOfRowsInSection: section)
@jaunesarmiento
jaunesarmiento / segue.rb
Created November 13, 2013 18:38
Passing data between view controllers using segues
class MyViewController < UITableViewController
attr_accessor :datasource
# .. UITableViewController delegate methods here ..
def prepareForSegue(segue, sender: sender)
if (segue.identifier.isEqualToString("segueIdentifier"))
index_path = @datasource.indexPathForSelectedRow
destination_view_controller = segue.destinationViewController
@jaunesarmiento
jaunesarmiento / app_delegate.rb
Created January 4, 2014 12:52
RubyMotion Tips
class AppDelegate
attr_accessor :window, :storyboard
def application(application, didFinishLaunchingWithOptions: launchOptions)
# Switch to a new rootViewController with transition
UIView.transitionWithView(
@window,
duration: 0.5,
@jaunesarmiento
jaunesarmiento / Rakefile
Created February 5, 2014 22:11
RubyMotion Example Rakefile
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion2.18/lib")
require 'motion/project/template/ios'
begin
require 'bundler'
require 'bubble-wrap'
require 'motion-stump'
require 'sugarcube-repl'
Bundler.require

Android L Menu Icon Toggle Animation

This is a recreation of Android L's toggle menu icon in the action bar. The icon morphs into a back button when toggled.

A Pen by Jaune Sarmiento on CodePen.

License.

@jaunesarmiento
jaunesarmiento / install-comodo-ssl-cert-for-nginx.rst
Last active August 29, 2015 14:25 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

function toCurrency(f) {
var fs = f.split('.');
var rs = fs[0].split('').reverse().join('');
var i = 0;
var ns = '';
while (i < rs.length) {
ns += (i % 3 == 0) ? ',' + rs[i] : rs[i];
i++;
}
return ns.slice(1).split('').reverse().join('') + '.' + ((fs[1] === undefined) ? '00' : fs[1]);