Skip to content

Instantly share code, notes, and snippets.

View lucascorrea's full-sized avatar
🇧🇷

Lucas Correa lucascorrea

🇧🇷
View GitHub Profile
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@idStar
idStar / automation.sh
Created September 2, 2012 23:48
UIAutomation test script invocation from the command line. Works with Xcode 4.4.1 and the iOS Simulator.
#!/bin/bash
# automation.sh
# Created by @idStar - Sohail Ahmed - September 2, 2012
# This script launches the UIAutomation Instrument targeting a pre-existing iOS Simulator app, from the command line.
# Works with Xcode 4.4.1 on Mountain Lion
#
# Usage:
# automation <"App Name.app"> <"testFile.js"> <"base test script path"> <"base iOS Simulator path"> <"results output directory">
#
#import <Foundation/Foundation.h>
@interface NSObject (NSDictionaryRepresentation)
/**
Returns an NSDictionary containing the properties of an object that are not nil.
*/
- (NSDictionary *)dictionaryRepresentation;
@end
@tacettin
tacettin / Rails
Created December 26, 2013 12:10
Rails namespace routes and custom action on resource
You need to add a collection
namespace :api do
namespace :v1 do
resources :users do
collection do
get 'all'
end
end
resources :sessions
@denisnazarov
denisnazarov / mvvm
Last active July 24, 2017 12:51
iOS ReactiveCocoa/MVVM Resources
## Collection of posts/videos I've found useful while researching mvvm
https://speakerdeck.com/jspahrsummers/code-reuse-with-mvvm
http://cocoasamurai.blogspot.com/2013/03/basic-mvvm-with-reactivecocoa.html
http://www.teehanlax.com/blog/model-view-viewmodel-for-ios/
http://martinfowler.com/eaaDev/PresentationModel.html
http://twocentstudios.com/blog/2014/06/08/on-mvvm-and-architecture-questions/
module Fastlane
module Actions
class AddIconOverlayAction < Action
def self.run(params)
Helper.log.info "Image to overlay on icons: #{params[:overlay_image_path]}"
require 'mini_magick'
appiconset = params[:appiconset_path]
@maxcampolo
maxcampolo / NativeWebView.swift
Created July 28, 2016 13:58
WKWebView setup to make a web page adopt native behavior.
import WebKit
class NativeWebViewController: UIViewController {
let viewportScriptString = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); meta.setAttribute('initial-scale', '1.0'); meta.setAttribute('maximum-scale', '1.0'); meta.setAttribute('minimum-scale', '1.0'); meta.setAttribute('user-scalable', 'no'); document.getElementsByTagName('head')[0].appendChild(meta);"
let disableSelectionScriptString = "document.documentElement.style.webkitUserSelect='none';"
let disableCalloutScriptString = "document.documentElement.style.webkitTouchCallout='none';"
override func viewDidLoad() {
// 1 - Make user scripts for injection
@Ravi61
Ravi61 / DecodingError.swift
Created July 13, 2017 15:30
Decoding Error Catch
//...
do {
let model = try jsonDecoder.decode(BattleShip.self, from: jsonData!)
print(model)
} catch DecodingError.dataCorrupted(let context) {
print(context.debugDescription)
} catch DecodingError.keyNotFound(let key, let context) {
print("\(key.stringValue) was not found, \(context.debugDescription)")
} catch DecodingError.typeMismatch(let type, let context) {
print("\(type) was expected, \(context.debugDescription)")
@bverhoeve
bverhoeve / parse_gpx.py
Created November 11, 2020 13:09
Parse GPX files to Xcode format
import logging
import os
from typing import List
import gpxpy
# Use
# Put the GPX files you want to parse in a folder 'gpx_files' next to this file
# Execute the file in a terminal: 'python3 parse_gpx.py'
# The output GPX files will be in a folder called 'parsed_files'
@laszlotuss
laszlotuss / AdaptiveStack.swift
Last active February 20, 2024 19:07
AdaptiveStack
import SwiftUI
struct AdaptiveStack<Content: View>: View {
@Environment(\.horizontalSizeClass) var sizeClass
let horizontalAlignment: HorizontalAlignment
let verticalAlignment: VerticalAlignment
let spacing: CGFloat?
let isVertical: Bool?
let content: () -> Content