Skip to content

Instantly share code, notes, and snippets.

View goshmx's full-sized avatar
💭
Build. Fail. Learn. Repeat. 👾

Gosh Hernandez goshmx

💭
Build. Fail. Learn. Repeat. 👾
View GitHub Profile
/* Funcion de peticion via AJAX
Ejemplo de Uso.
peticionApi('post','http://my-url.com','variable1=valor1&variable2=valor2')
.done(function(dato){
//Codigo de ejecucion en codigo 200
})
.fail(function(){
//Codigo de ejecucion en error
});
*/
@goshmx
goshmx / Table-Functions UITableView
Created January 26, 2015 16:45
Codigo para integrar funciones de tablas de UI Table View
/**********************************************************************************************
Table Functions
**********************************************************************************************/
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
//-------------------------------------------------------------------------------
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
@goshmx
goshmx / Rounded UIImageView
Created January 29, 2015 10:01
Redondear esquinas de un UIImageView Objetive C
UIImageView * roundedView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"test.jpg"]];
CALayer * l = [roundedView layer];
[l setMasksToBounds:YES];
[l setCornerRadius:10.0];
// Agregar borde y color(opcional)
[l setBorderWidth:4.0];
[l setBorderColor:[[UIColor blueColor] CGColor]];
@goshmx
goshmx / AnimKeyboard
Created February 3, 2015 08:01
Codigo para animar el UIView cuando el teclado oculta el input.
//Recuerda incluir UITextViewDelegate en tu archivo.h y hacer un delegate al input self.inputEstado.delegate = self;
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self animateTextField:textField up:YES];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
@goshmx
goshmx / Sharing Social
Created February 4, 2015 03:37
Compartir en redes sociales. Objetive C
//Recuerda agregar los archivos dependientes a tu archivo.h
//#import <Accounts/Accounts.h>
//#import <Social/Social.h>
//#import <Twitter/Twitter.h>
NSString *strMsg;
NSArray *activityItems;
UIImage *imgShare;
UIActivityViewController *actVC;
@goshmx
goshmx / Camera Picker
Last active August 29, 2015 14:14
Funciones para trabajar con la libreria de la camara
alert = [[UIAlertView alloc] initWithTitle:@"Fotografia"
message:@"Que desea hacer?"
delegate:self
cancelButtonTitle:@"Cancelar"
otherButtonTitles:@"Camara", @"Carrete", nil];
[alert show];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
@goshmx
goshmx / Ajax-load-files-laravel
Created February 27, 2015 07:46
Snippet para subir archivos via AJAX a laravel.
<script>
//Enviar el formulario via FormData
var data = new FormData($('#form-nuevo')[0]);
console.log(data);
$.ajax( {
url: myApp.url.rest+'sistema/imagen',
type: 'POST',
data: data,
processData: false,

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@goshmx
goshmx / livestream
Last active August 29, 2015 14:26 — forked from deandob/livestream
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
@goshmx
goshmx / livestream
Last active August 29, 2015 14:26 — forked from dbussert/livestream
var child_process = require('child_process'),
http = require('http');
url = require('url'),
ffmpeg = null;
var livestream = function (req, resp) {
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var input = 'udp://225.1.1.1:8208';