Skip to content

Instantly share code, notes, and snippets.

View jcguarinpenaranda's full-sized avatar
😀

Juan Camilo Guarin Peñaranda jcguarinpenaranda

😀
View GitHub Profile
@jcguarinpenaranda
jcguarinpenaranda / ubuntu-cli-install-android-sdk.sh
Created November 7, 2017 10:56 — forked from zhy0/ubuntu-cli-install-android-sdk.sh
Install Android SDK on headless Ubuntu linux machine via command line, so that you can compile open source Android apps.
#!/bin/bash
# Thanks to https://gist.github.com/wenzhixin/43cf3ce909c24948c6e7
# Execute this script in your home directory. Lines 17 and 21 will prompt you for a y/n
# Install Oracle JDK 8
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
apt-get install -y unzip make # NDK stuff
@jcguarinpenaranda
jcguarinpenaranda / iso_639-2.json
Created December 21, 2016 02:05 — forked from franz-josef-kaiser/iso_639-2.json
ISO 639-2 JSON file that contains different international as well as local names for languages. The file is sorted by the ISO 639-2 language codes
{
"aar":
{
"int":["Afar"],
"native":["Afaraf"]
},
"aa":
{
"int":["Afar"],
"native":["Afaraf"]
@jcguarinpenaranda
jcguarinpenaranda / center_vertical.css
Created August 23, 2016 03:47
Center vertically items with css very easy
.center-vertical{
display: flex;
align-items: center;
justify-content: center;
}
.fullscreen{
width:100%;
min-height:100vh;
}
@jcguarinpenaranda
jcguarinpenaranda / enviarmail.php
Created April 29, 2016 00:57
Enviar un email a una dirección de correo, cuando se haya enviado un formulario de contacto
<?php
if (isset($_POST['nombre']) && isset($_POST['correo']) && isset($_POST['asunto']) && isset($_POST['empresa']) && isset($_POST['mensaje'])) {
// Varios destinatarios
$correo= $_POST['correo'];
$nombre = html_entity_decode($_POST['nombre']);
$asunto = html_entity_decode($_POST['asunto']);
$mensajepost = html_entity_decode($_POST['mensaje']);
$empresa = html_entity_decode($_POST['empresa']);
@jcguarinpenaranda
jcguarinpenaranda / gif
Created April 14, 2016 23:17
Create GIF from terminal
#!/bin/bash
# AUTHOR: (c) Rob W 2012, modified by MHC (http://askubuntu.com/users/81372/mhc)
# NAME: GIFRecord 0.1
# DESCRIPTION: A script to record GIF screencasts.
# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
# DEPENDENCIES: byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd)
# Time and date
TIME=$(date +"%Y-%m-%d_%H%M%S")
@jcguarinpenaranda
jcguarinpenaranda / angular-socket.js
Created October 20, 2015 04:22
Angular js socket io factory
app.factory('socket', function ($rootScope) {
var socket = io.connect();
return {
on: function (eventName, callback) {
socket.on(eventName, function () {
var args = arguments;
$rootScope.$apply(function () {
callback.apply(socket, args);
});
});
@jcguarinpenaranda
jcguarinpenaranda / Angular JS http post fix
Created October 1, 2015 01:33
Angular JS http post fix
.config(['$httpProvider', function ($httpProvider) {
// Intercept POST requests, convert to standard form encoding
$httpProvider.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
$httpProvider.defaults.transformRequest.unshift(function (data, headersGetter) {
var key, result = [];
if (typeof data === "string")
return data;
for (key in data) {
@jcguarinpenaranda
jcguarinpenaranda / Notify in android statusbar
Created September 26, 2015 18:11
Notify in android statusbar method
private void notifyStatusBar(String title, String text){
NotificationManager notificationManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
Intent intent = new Intent(this, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, (int) System.currentTimeMillis(), intent, 0);
Notification n = new NotificationCompat.Builder(this)
@jcguarinpenaranda
jcguarinpenaranda / PinchZoom.cs
Created August 8, 2015 23:29
Pinch to zoom camera in Unity 3d
using UnityEngine;
public class PinchZoom : MonoBehaviour
{
public float perspectiveZoomSpeed = 0.5f; // The rate of change of the field of view in perspective mode.
public float orthoZoomSpeed = 0.5f; // The rate of change of the orthographic size in orthographic mode.
void Update()
{
@jcguarinpenaranda
jcguarinpenaranda / LoadScene.cs
Created August 8, 2015 22:52
Load a scene in Unity 3d
using UnityEngine;
using System.Collections;
public class LoadScene : MonoBehaviour {
public GameObject loadingImage;
public void LoadScene(int level)
{
loadingImage.SetActive(true);