Skip to content

Instantly share code, notes, and snippets.

View mayoralito's full-sized avatar
:octocat:
This is the way!

amayoral mayoralito

:octocat:
This is the way!
View GitHub Profile
@mayoralito
mayoralito / NetworkHandler.swift
Created November 16, 2017 00:57
Basic usage of Router for Network calls
// Swift 3
// Alamofire 4
enum Router: URLRequestConvertible {
case updateUser(userId: Int, body:[String:Any])
var method: HTTPMethod {
switch self {
case . updateUser(_,_):
return .put
class ViewController: UIViewController {
var animator: UIDynamicAnimator!
var gravity: UIGravityBehavior!
var collision: UICollisionBehavior!
override func viewDidLoad() {
super.viewDidLoad()
// --------------------------------------
//
@mayoralito
mayoralito / ssid-osx.sh
Created October 17, 2016 14:21
Getting SSID via command line
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'
@mayoralito
mayoralito / aws-sns-example.js
Created July 24, 2016 14:30 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@mayoralito
mayoralito / gist:ab40fc81e1b90eef563e8b62192ee2b2
Created April 23, 2016 20:49 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@mayoralito
mayoralito / squid.conf
Last active October 17, 2016 14:26
squid configuration file.
acl localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
@mayoralito
mayoralito / fuckingblocksyntax.swift
Last active September 2, 2015 15:16
fuckingblocksyntax.com using Swift
// As a local variable:
// Objective C - http://fuckingblocksyntax.com/
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
As a property:
// Swift -
@mayoralito
mayoralito / AMTextField
Last active August 29, 2015 14:14
Objective C snippets
// .h file
#import <UIKit/UIKit.h>
@interface AMTextField : UITextField
@property (nonatomic, assign) UIEdgeInsets edgeInsets;
@end
// .m file
#import "AMTextField.h"
@mayoralito
mayoralito / examples
Created January 10, 2015 21:56
examples
//
// ViewController.m
// DemoInterview
//
// Created by amayoral on 1/10/15.
// Copyright (c) 2015 vRoutes. All rights reserved.
//
#import "ViewController.h"
<?php
/**
* Copyright (c) 2013 Roman Ožana (http://omdesign.cz)
*
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*
* @author Roman Ozana <ozana@omdesign.cz>
* @method Homepage()
* @method Homepage_actiom()