Skip to content

Instantly share code, notes, and snippets.

View juliofruta's full-sized avatar
💭
🧠

Julio Fruta juliofruta

💭
🧠
View GitHub Profile
@juliofruta
juliofruta / git.sh
Last active March 11, 2023 00:18
Useful git & github cli commands for you!
# git
git init # Initialize git on the current folder
git checkout -b <new-branch-name> # Create a branch
git checkout <existing-branch> # Checkout a branch
git fetch --all # Get latest commits from origin
git add <file> # Add file to the stage area
git commit # Commit stages
git push origin <branch> # Push a branch to origin
git push origin <branch> --force # Force push a branch to origin
@juliofruta
juliofruta / button.swift
Last active August 8, 2016 22:58
Avoid button targets in Swift 2.2
class Button : UIButton {
private var _action : (()->())?
var action : ()->() {
get {
return _action!
}
set (newAction) {
_action = newAction
self.addTarget(self,
action: #selector(Button.actionCaller),
@juliofruta
juliofruta / example.swift
Last active August 8, 2016 22:54
A gist for examples
let tableViewA = UITableViewController()
let tableViewB = UITableViewController()
let viewController = UIViewController()
viewController.addChildViewController(tableViewA)
viewController.addChildViewController(tableViewB)
tableViewA.view.frame = CGRect(x: 0.0, y: 0.0, width: 300, height: 250)
tableViewB.view.frame = CGRect(x: 0.0, y: 250.0 , width: 300, height: 250)
viewController.view.frame = CGRect(x: 0.0, y: 0.0, width: 300, height: 500)
@juliofruta
juliofruta / mergegenstrings.py
Created January 25, 2017 17:44 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@juliofruta
juliofruta / UnfoldSequenceExtension.swift
Last active April 16, 2017 18:58
UnfoldSequence to [UnfoldSequence.Iterator.Element]
extension UnfoldSequence {
func toArray(filter : (UnfoldSequence.Iterator.Element) -> (Bool) ) -> [UnfoldSequence.Iterator.Element] {
var arreglo = Array<UnfoldSequence.Iterator.Element>()
for value in self {
if !filter(value) { break }
arreglo.append(value)
}
return arreglo
}
}
@juliofruta
juliofruta / AVURLAssetLoading.m
Created June 12, 2017 21:35
How to reproduce assets at the same time
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url options:nil];
NSArray *keys = [NSArray arrayWithObject:@"playable"];
//Carga los assets
[asset loadValuesAsynchronouslyForKeys:keys completionHandler:^()
{
//Al terminar reproducelos en la cola principal
dispatch_async(dispatch_get_main_queue(), ^
{
AVPlayerItem *playerItem = [[[AVPlayerItem alloc] initWithAsset:asset] autorelease];
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
Git Tips & Tricks - GitHub Satellite 2017: https://www.youtube.com/watch?v=moDdhDxzg2k
@juliofruta
juliofruta / gist:9bf873d358bdf77f27be63dd1472c614
Created October 20, 2017 16:22 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@juliofruta
juliofruta / container.swift
Created December 3, 2017 15:09
JSON 4 Swift bug
// For this JSON:
{
"success": true,
"payload": {
"asks": [{
"book": "btc_mxn",
"price": "5632.24",
"amount": "1.34491802"
},{
"book": "btc_mxn",