Skip to content

Instantly share code, notes, and snippets.

View policante's full-sized avatar
🏠
Working from home

Rodrigo Martins policante

🏠
Working from home
View GitHub Profile
@policante
policante / android.sh
Created July 20, 2016 17:02
Android command line tools OSX
export ANDROID_SDK_VERSION=24.0.0
export ANDROID_HOME=~/Library/Android/sdk/
export ANDROID_TOOLS=$ANDROID_HOME/tools
export ANDROID_BUILD_TOOLS=$ANDROID_HOME/build-tools/$ANDROID_SDK_VERSION
export ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:$ANDROID_BUILD_TOOLS
@policante
policante / KeyboardPlate.java
Created July 27, 2016 20:38
Plate keyboard layout
package com.example.policante.meuapptest;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.TextView;
@policante
policante / ios-framework-universal.sh
Created August 9, 2016 19:26
create a universal framework (iOS)
# Merge Script
# 1
# Set bash script to exit immediately if any commands fail.
set -e
# 2
# Setup some constants for use later on.
FRAMEWORK_NAME="SampleFramework"
@policante
policante / shorten.sh
Created August 28, 2016 19:13
Create shorturl via terminal (BIT.LY)
#!/bin/bash
curl -s "http://api.bitly.com/v3/shorten?login=[LOGIN]&apiKey=[API_SECRET]&longUrl=$1&format=txt" | pbcopy
@policante
policante / UIView+Shimmer.swift
Created February 6, 2017 14:09
Shimmer effect to UIView
extension UIView {
func startShimmering(){
let light = UIColor.white.cgColor
let alpha = UIColor.white.withAlphaComponent(0.7).cgColor
let gradient = CAGradientLayer()
gradient.colors = [alpha, light, alpha, alpha, light, alpha]
gradient.frame = CGRect(x: -self.bounds.size.width, y: 0, width: 3 * self.bounds.size.width, height: self.bounds.size.height)
gradient.startPoint = CGPoint(x: 0.0, y: 0.5)
@policante
policante / FlexibleSearchView.xml
Created March 22, 2017 20:25
Flexible toolbar and SearchView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f2f2f2">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
@policante
policante / BlogController.php
Created May 28, 2017 16:54 — forked from tobysteward/BlogController.php
Laravel AJAX Pagination with JQuery
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@policante
policante / OnSwipeTouchListener.java
Created June 26, 2017 12:53
Detect touch listener
import android.content.Context;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
public class OnSwipeTouchListener implements OnTouchListener {
private final GestureDetector gestureDetector;
@policante
policante / CountDown.java
Created July 13, 2017 11:57
CountDown timer
public class CountDown {
private CountDownTimer countDownTimer;
private int timeSeconds = 30;
public CountDown(){
countDownTimer = new CountDownTimer(timeSeconds * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
String v = String.format("%02d", millisUntilFinished / 60000);
@policante
policante / Podfile
Created October 13, 2017 12:45
Podfile with build settings SWIFT_VERSION specific
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyProject' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|