Skip to content

Instantly share code, notes, and snippets.

View jaunesarmiento's full-sized avatar

Jaune Carlo Sarmiento jaunesarmiento

View GitHub Profile
@jaunesarmiento
jaunesarmiento / gist:fdb872f12f6521e1b088a84af69dd41a
Created November 19, 2017 09:14 — forked from xaphod/gist:7aab1302004f6e933593a11ad8f5a72d
Scroll keyboard up just enough to show control. Swift 3.
// note that currentFirstResponder is obtained by this:
//
// static var currentFirstResponder: UIResponder?
// func findFirstResponder(sender: Any) {
// currentFirstResponder = self
// }
//
// class func currentFirstResponder() -> UIResponder? {
// currentFirstResponder = nil
// UIApplication.shared.sendAction(#selector(findFirstResponder), to: nil, from: nil, for: nil)
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
'use strict'
import React, { Component } from 'react'
import {
TouchableOpacity,
View,
} from 'react-native'
class ColorButton extends Component {
@jaunesarmiento
jaunesarmiento / MyComponent.js
Last active April 21, 2017 06:11
React Native Style Utils
'use strict'
import React, { Component } from 'react'
import {
Text,
View
} from 'react-native'
// Styles are separated from the component
// since components tend to have crazy number of lines
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]);
@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

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 / 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
@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 / 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