Skip to content

Instantly share code, notes, and snippets.

View gbertb's full-sized avatar

Gilbert Bagaoisan gbertb

View GitHub Profile
(function() {
var libraryStorage = {};
function librarySystem(libraryName, dependency, callback) {
if (arguments.length > 1) {
// If library has no dependency
if (dependency.length === 0) {
libraryStorage[libraryName] = callback();
// has one or more dependencies
} else {
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
lon= -77.035974
lat = 38.898717
@gbertb
gbertb / AutoDescribingObjects.swift
Created September 28, 2016 15:21 — forked from YogevSitton-zz/AutoDescribingObjects.swift
Use auto-describing objects with CustomStringConvertible
extension CustomStringConvertible {
var description : String {
var description: String = ""
if self is AnyObject {
description = "***** \(self.dynamicType) - <\(unsafeAddressOf((self as! AnyObject)))>***** \n"
} else {
description = "***** \(self.dynamicType) *****\n"
}
let selfMirror = Mirror(reflecting: self)
for child in selfMirror.children {
@gbertb
gbertb / gist:8e1d36af0076292050529f6729ba22ac
Created September 18, 2016 03:51 — forked from michaelteter/gist:442894d8ccdc9ada3cd2f2513dbf1849
Xcode 8, Swift 3, and Alamofire - getting it setup and building
Alamofire has recently been updated. Now it seems to support Swift 3 from its main (master) branch.
Below are instructions that should work :)
------------------------------------------------------------------------------------------------
CURRENT INSTRUCTIONS ---------------------------------------------------------------------------
1. Install cocoapods
$ sudo gem install cocoapods
2. create an xcode project
@gbertb
gbertb / Constants.swift
Created February 3, 2016 05:42
adding constants file in swift
//
// Constants.swift
//
// Created by Jarrod Parkes on 11/5/15.
// Copyright © 2015 Udacity. All rights reserved.
//
// MARK: - Constants
struct Constants {
#!/bin/sh
#----------------------------------------------------
# a simple mysql database backup script.
# version 2, updated March 26, 2011.
# copyright 2011 alvin alexander, http://devdaily.com
#----------------------------------------------------
# This work is licensed under a Creative Commons
# Attribution-ShareAlike 3.0 Unported License;
# see http://creativecommons.org/licenses/by-sa/3.0/
@gbertb
gbertb / Step-wizard.markdown
Created October 22, 2014 02:50
A Pen by Hugo Giraudel.
@gbertb
gbertb / font-awesome.js
Created March 12, 2014 06:40
How to load Font Awesome asynchronously
<!--
How to load Font Awesome asynchronously
Use: Just put this script on the bottom/footer of your web
-->
<script type="text/javascript">
(function() {
var css = document.createElement('link');
css.href = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css';
If you get this when trying to connect to PG
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
A pid file was blocking postgres from starting up. To fix it:
rm /usr/local/var/postgres/postmaster.pid

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.