Skip to content

Instantly share code, notes, and snippets.

Avatar

Libin Bensin libinbensin

View GitHub Profile
@libinbensin
libinbensin / deploy-static-site-heroku.md
Created May 29, 2016 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku
View deploy-static-site-heroku.md

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@libinbensin
libinbensin / MediaPlayerStateWrapper.java
Created Oct 31, 2015 — forked from bitops/MediaPlayerStateWrapper.java
A drop-in replacement for a MediaPlayer instance, that provides an accessor for the current state.
View MediaPlayerStateWrapper.java
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import android.media.AudioManager;
import android.media.MediaPlayer;
@libinbensin
libinbensin / card_layout
Created Sep 23, 2015 — forked from biokys/card_layout
Card layout with bottom shadow
View card_layout
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="@dimen/card_corner_radius"/>
<solid android:color="#bbb" />
</shape>
View InstallTomcat
Here are the easy to follow steps to get it up and running on your Mac
Download a binary distribution of the core module: apache-tomcat-7.0.47.tar.gz from here. I picked the tar.gz in Binary Distributions / Core section.
Opening/unarchiving the archive will create a folder structure in your Downloads folder: (btw, this free Unarchiver app is perfect for all kinds of compressed files and superior to the built-in Archive Utility.app)
~/Downloads/apache-tomcat-7.0.47
Open to Terminal app to move the unarchived distribution to /usr/local
sudo mkdir -p /usr/local
sudo mv ~/Downloads/apache-tomcat-7.0.47 /usr/local
@libinbensin
libinbensin / StartTomcat.txt
Last active Aug 29, 2015
Start Apache Tomcat at boot on Mac OS X
View StartTomcat.txt
This is for installing tomcat as a daemon on port 8080 but enable also port 80 by using a firewall redirection.
Edit /Library/Tomcat/conf/server.xml and add proxyport="80" URIEncoding="UTF-8" inside <Connector .../>.
<Connector proxyport="80" URIEncoding="UTF-8" />
Assign enough memory to the Java machine or you may be in trouble later. Inside /Library/Tomcat/conf/local.env
export JAVA_JVM_VERSION=CurrentJDK
export JAVA_OPTS="-Xmx3000M -Xms3000M -Djava.awt.headless=true -Duser.timezone=UTC"
View CollapsingTitleLayout.java
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View SlidingUpPanelView
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
View strip_play_services.gradle
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
@libinbensin
libinbensin / HorizontalListView.java
Created May 9, 2014
HorizontalListView to add items horizontally
View HorizontalListView.java
import android.content.Context;
import android.database.DataSetObserver;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
@libinbensin
libinbensin / AndroidManifest.xml
Created May 9, 2014
Widget with Service (Custom Action)
View AndroidManifest.xml
/** change the service in manifest to receive custom action **/
<service android:name="com.stackwork.app.services.CustomService" >
<intent-filter>
<action android:name="com.mediabook.app.ACTION_PLAY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>