Skip to content

Instantly share code, notes, and snippets.

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

Wayan jimmy wayanjimmy

🏠
Working from home
View GitHub Profile
@wayanjimmy
wayanjimmy / fix_gitignore.sh
Last active October 21, 2015 05:41
Fix gitignore
git rm -r --cached . && git add . && git commit -m "fixing .gitignore"
@wayanjimmy
wayanjimmy / genymotion_etc_hosts.sh
Created October 13, 2015 07:22
Push genymotion /etc/hosts
adb root && adb remount && adb push /etc/hosts /system/etc
@wayanjimmy
wayanjimmy / node-and-npm-in-30-seconds.sh
Created October 8, 2015 10:12 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@wayanjimmy
wayanjimmy / http_response.php
Created September 18, 2015 08:06
Http response
<?php
/**
* get string representation of HTTP message from HTTP response code
* @param int $code
* @return string
* @throws Exception
*/
function http_response_message($code)
{
switch ($code) {
@wayanjimmy
wayanjimmy / basicSelect.php
Last active August 29, 2015 14:27 — forked from basdenooijer/basicSelect.php
Solarium select examples
<?php
// A query without any settings will use default values.
// This will result in a "*:*" query, 10 rows, all fields.
$query = new Solarium_Query_Select;
$result = $client->select($query);
echo 'Number of results found: ' . $result->getNumFound();
// The resultset is iterable, you could also use $result->getDocuments() to get an array with documents.
@wayanjimmy
wayanjimmy / deploy.rb
Last active August 29, 2015 14:26 — forked from mul14/deploy.rb
Deploy Laravel 4 with mina http://mina-deploy.github.io/mina/
require 'mina/git'
# Fix the SSH password prompt problem
set :term_mode, nil
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)
@wayanjimmy
wayanjimmy / android_application_class.java
Created June 25, 2015 09:38
Sample Android Application Class
package io.jirra.android.managers;
import android.app.Application;
import com.mikepenz.community_material_typeface_library.CommunityMaterial;
import com.mikepenz.iconics.Iconics;
public class JirraApp extends Application {
public JirraApp() {
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed
# Ubuntu 15.04
# I'm using Zsh shell
# Node JS
sudo apt-get install python-software-properties
sudo apt-get install nodejs
sudo apt-get install npm
# Fix nodeJS
echo prefix = ~/.node >> ~/.npmrc
echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.zshrc
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;