Skip to content

Instantly share code, notes, and snippets.

@dlfinis
dlfinis / SplashActivity.java
Last active August 29, 2015 14:11
Create a Splash Activity with Handler
package com.app.splash;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import java.util.Timer;
import java.util.TimerTask;
@dlfinis
dlfinis / AndroidManifest.xml
Last active August 29, 2015 14:11
AndroidManisfest definition of a SplashScreen
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.splash" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
@dlfinis
dlfinis / Auto-Close Dialog
Created December 19, 2014 22:05
Button Listener with auto-close Alert Dialog
private View.OnClickListener btnJagger_onClickListener = new View.OnClickListener() {
String message="";
@Override
public void onClick(final View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
message=(getString(R.string.thanks)+"\n"+getString(R.string.about)) ;
builder.setTitle(R.string.company_name);
@dlfinis
dlfinis / Share with Apps - Simple
Created December 20, 2014 19:43
Button Listener to share content with other App
private View.OnClickListener btnShare_onClickListener= new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent textShareIntent = new Intent(Intent.ACTION_SEND);
textShareIntent.putExtra(Intent.EXTRA_TEXT,getString(R.string.message_share));
textShareIntent.setType("text/plain");
//startActivity(textShareIntent);
// ^^ this auto-picks the defined default program for a content type, but since we want users to
// have options, we instead use the OS to create a chooser for users to pick from
@dlfinis
dlfinis / colors.xml
Created February 7, 2015 01:07
Color Palette of Material Design
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
@dlfinis
dlfinis / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@dlfinis
dlfinis / Admin Dockbar
Created April 21, 2015 14:40
Show the dockbar only with admin users.
#if (($permissionChecker.isOmniadmin())||$permissionChecker.isCompanyAdmin($themeDisplay.getCompanyId())||
$permissionChecker.isCommunityAdmin($themeDisplay.getScopeGroupId()))
#dockbar()
#end
@dlfinis
dlfinis / reemplazo-cadenas
Created May 7, 2015 23:13
Reemplazo de Cadenas
### [Utilizacion en entornos/herramientas que utilizen comandos de GNU/Linux]
### Ubicarse en el directorio que se reemplazaran las cadenas
##Recursivo
grep -rl 'windows' ./ | xargs sed -i 's/windows/linux/g'
##Incluido elementos ocultos
find . -type f -exec sed -i 's/foo/bar/g' {} +
@dlfinis
dlfinis / liferay-web-content-journal
Last active May 18, 2017 02:17
Web Content Liferay access to Journal Objects
##Check that have added these properties in the portal-ext.properties file
journal.template.velocity.restricted.variables=
velocity.engine.restricted.classes=
velocity.engine.restricted.variables=
## Way to add a web content by id
#set ($group_id = $getterUtil.getLong($request.theme-display.scope-group-id))
#set ($webcontent-id = "0101")
#set ($webcontent=$journalContentUtil.getContent($group_id, $webcontent-id, "", "$locale", ""))
@dlfinis
dlfinis / check-jquery
Created May 14, 2015 15:13
Check if exits an jquery script load
## One way
if(!("jQuery" in window)) {
var head = document.getElementsByTagName('head')[0],
script = document.createElement('script');
script.type = 'text/javascript';
script.src = '/resources/js/lib/jquery-2.1.0.min.js';
head.appendChild(script);
}