Skip to content

Instantly share code, notes, and snippets.

View axelrivera's full-sized avatar

Axel Rivera axelrivera

View GitHub Profile
@axelrivera
axelrivera / MKMapView+ShowHide.swift
Created May 1, 2023 23:29 — forked from danielrotaermel/MKMapView+ShowHide.swift
MKAnnotationView extensions to show/hide annotations completely
//
// MKMapView+ShowHide.swift
//
// Created by Daniel Rotärmel on 27.10.20.
//
import MapKit
// MKAnnotationView extensions to show/hide annotations completely
extension MKMapView {
var query: PFQuery = PFQuery(className: "userPhoto")
query.findObjectsInBackgroundWithBlock { [weak self] (objects, error) -> Void in
if let weakSelf = self {
println("Got \(objects.count) entries")
weakSelf.feedData = objects
weakSelf.tableView.reloadData()
}
}
@implementation UITextView (Annex)
@dynamic visibleTextRange;
- (NSRange)visibleTextRange
{
CGRect bounds = self.bounds;
CGSize textSize = [self.text sizeWithFont:self.font constrainedToSize:bounds.size];
UITextPosition *start = [self characterRangeAtPoint:bounds.origin].start;
guard 'shell' do
watch(/relation_tree_spec\.rb/) { `clear && ruby relation_tree_spec.rb` }
end
@axelrivera
axelrivera / setenv.sh
Last active December 28, 2015 10:29 — forked from terrancesnyder/setenv.sh
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
UIGraphicsBeginImageContextWithOptions(_site.bounds.size, NO, [UIScreen mainScreen].scale);
} else {
UIGraphicsBeginImageContext(_site.frame.size);
}
[_site.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
# Install rvm system-wide
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
# Update the packages
apt-get update
apt-get upgrade
apt-get install build-essential
# get the packages required by ruby
rvm pkg install zlib
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@axelrivera
axelrivera / hack.sh
Created March 31, 2012 13:47 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#