Skip to content

Instantly share code, notes, and snippets.

Carlos García carlosypunto

  • Madrid, Spain
View GitHub Profile
View Swift Function composition operator direction
//: Sample based on Function Composition snippet from objc.io: http://www.objc.io/snippets/2.html
import Foundation
func getContents(url: String) -> String {
return NSString(contentsOfURL: NSURL(string: url)!, encoding: NSUTF8StringEncoding, error: nil)! as String
}
func lines(input: String) -> [String] {
return input.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet())
}
@carlosypunto
carlosypunto / gist.swift
Last active Apr 19, 2016
Swift 2 Abstarct Class
View gist.swift
protocol MyInterface {
func myMethod() -> String
}
extension MyInterface {
func myMethod() -> String {
fatalError("Not Implemented")
@carlosypunto
carlosypunto / mount-vm-sharedfolders.conf
Last active Jan 16, 2017
Mount/unmout vmware shared folders on home directory with owner uid and gid when start/stop Ubuntu desktop session
View mount-vm-sharedfolders.conf
start on desktop-start
stop on desktop-end
script
vmhgfs-fuse -o uid=`id -u` -o gid=`id -g` ~/vmshare
end script
@carlosypunto
carlosypunto / mkicns.sh
Created Dec 18, 2017
Function to quickly create an application icon from 1024px master file
View mkicns.sh
function mkicns() {
if [[ -z "$@" ]]; then
echo "Input file missing"
else
filename=${1%.*}
mkdir $filename.iconset
sips -z 16 16 $1 --out $filename.iconset/icon_16x16.png
sips -z 32 32 $1 --out $filename.iconset/icon_16x16@2x.png
sips -z 32 32 $1 --out $filename.iconset/icon_32x32.png
sips -z 64 64 $1 --out $filename.iconset/icon_32x32@2x.png
@carlosypunto
carlosypunto / gist.swift
Last active Mar 23, 2018
Swift 2 Multiparadigm Decorator Pattern
View gist.swift
// Decorable Protocol --------------------------------------------------------------------
protocol IBeverage {
func description() -> String
func cost() -> Double
}
extension IBeverage {
func printDescription() {
@carlosypunto
carlosypunto / Podfile
Created Sep 14, 2018 — forked from arturgrigor/Podfile
Sample Podfile for silencing warnings for CocoaPods dependencies
View Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target '%TargetName%' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for %TargetName%
# pod 'FBSDKCoreKit'
end
@carlosypunto
carlosypunto / clean_localizable.swift
Created Dec 8, 2019
Localizable string checker script for use in Xcode project Build Phases
View clean_localizable.swift
#!/usr/bin/xcrun --sdk macosx swift
import Foundation
let fileManager = FileManager.default
//let currentPath = fileManager.currentDirectoryPath
let currentPath = "/Users/carlos/Pecunpay/GeltCash/Implementación/Geltcash"
You can’t perform that action at this time.