Skip to content

Instantly share code, notes, and snippets.

View codeasashu's full-sized avatar
🌊
Waiting to sail

ashutosh chaudhary codeasashu

🌊
Waiting to sail
View GitHub Profile
@codeasashu
codeasashu / SimpleDatabaseHelper.java
Created May 27, 2016 20:16 — forked from mikeplate/SimpleDatabaseHelper.java
Android SQLite very simple database helper example
package se.mobileapplab.datademo;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Class that wraps the most common database operations. This example assumes you want a single table and data entity
@codeasashu
codeasashu / change_wwwdata.sh
Last active May 17, 2016 14:20
How to enable current linux user to add or edit files in recently installed LAMP stack
sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
@codeasashu
codeasashu / links.txt
Created May 9, 2016 08:11
useful snippets links
@codeasashu
codeasashu / wp_list_table
Created April 22, 2016 22:44 — forked from donaldallen/wp_list_table
WP_List_Table example.
<?php
if ( ! class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class Events_List_Table extends WP_List_Table
{
function __construct()
{
global $status, $page;
@codeasashu
codeasashu / activity_main.xml
Created April 8, 2016 15:13
Facebook login in SDK v 4.0
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<com.facebook.login.widget.LoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
@codeasashu
codeasashu / install_ffmpeg_ubuntu.sh
Created December 13, 2015 23:00 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@codeasashu
codeasashu / help.xml
Created November 21, 2015 21:40
Show whole layout within dialog in android
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="rtl">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_text"
@codeasashu
codeasashu / limitrange.java
Created November 21, 2015 21:26
This gist provides means to limit numeric range on edittext
package com.test;
import android.text.InputFilter;
import android.text.Spanned;
public class InputFilterMinMax implements InputFilter {
private int min, max;
public InputFilterMinMax(int min, int max) {
@codeasashu
codeasashu / activity_main.xml
Created November 19, 2015 14:10
horizontally partitioned layouts
<?xml version="1.0" encoding="utf-8"?>
<!-- You can also put all this within scrollview for better -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:baselineAligned="false"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="0dip"
package com.company.app.helper;
import android.content.Context;
import android.graphics.Typeface;
import android.util.Log;
import java.io.File;
/**
* Created by Sid on 11/11/2015.
*/