Skip to content

Instantly share code, notes, and snippets.

View rbreve's full-sized avatar

Roberto Brevé rbreve

  • Finland
View GitHub Profile
@rbreve
rbreve / flip.cs
Last active August 29, 2015 14:14
Flip gameObject vertically Unity3D
void turnAround(){
Vector3 targetAngles = gameObject.transform.eulerAngles + 180f * Vector3.up;
gameObject.transform.eulerAngles = targetAngles;
}
@rbreve
rbreve / gist:3cfedda4d53a98317ba0
Last active August 29, 2015 14:18
Geek Honduras FAQ
Geek Honduras FAQ
¿Cual es el mejor proveedor de Internet?
Depende de la zona.
1.Claro
2.Cable Color
3.Amnet
@rbreve
rbreve / CameraShake.cs
Created July 3, 2015 21:06
Simple camera shake script for Unity3d
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour {
Camera cam;
public float shakeTime=0.2f;
float timeStop=0;
float shakeAmount=0.3f;
Vector3 originPosition;
@rbreve
rbreve / tapdetect.cs
Created April 7, 2016 00:23
One Tap Detect Unity3D
foreach (Touch touch in Input.touches) {
if( touch.phase == TouchPhase.Ended ){
if(touch.tapCount == 1){
Debug.Log("Tap");
}
}
}
[{
"category_name": "Birthday",
"slug": "birthday"
}, {
"category_name": "Good Luck",
"slug": "goodluck"
}]
@rbreve
rbreve / stickyheader.m
Created November 10, 2016 00:42
Floating Header UICollectionView Objective C
- (void)viewDidLoad {
//add this on your viewDidLoad
UICollectionViewFlowLayout *flow = (UICollectionViewFlowLayout *)self.collectionViewLayout;
flow.sectionHeadersPinToVisibleBounds = YES;
}
@rbreve
rbreve / floating.m
Created November 10, 2016 22:09
Floating view inside UIScrollView
CGPoint currentOffset;
//Save the initial scrollview offset when adding floating view on the UIScrollView
currentOffset = scrollView.contentOffset;
- (void) scrollViewDidScroll:(UIScrollView *)scrollView{
CGRect frame = self.floatingView.frame;
frame.origin.x -= (currentOffset.x - scrollView.contentOffset.x);
frame.origin.y -= (currentOffset.y - scrollView.contentOffset.y);
@rbreve
rbreve / back.m
Created November 11, 2016 00:12
Add custom title to the back button on a navigationBar iOS
UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithTitle:@"CustomText" UIBarButtonItemStylePlain target:self action:nil];
back.tintColor = [UIColor themeColor];
self.navigationController.navigationBar.topItem.backBarButtonItem = back;
@rbreve
rbreve / download.m
Created November 25, 2016 16:04
download video
-(void) downloadVideo:(NSString *) urlToDownload
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSLog(@"Downloading Started");
NSURL *url = [NSURL URLWithString:urlToDownload];
NSData *urlData = [NSData dataWithContentsOfURL:url];
if ( urlData )
{
NSString *outputURL = NSTemporaryDirectory();
@rbreve
rbreve / .gitignore
Created February 14, 2017 21:15
Git Ignore
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser