Skip to content

Instantly share code, notes, and snippets.

View rohitsthaa's full-sized avatar

Rohit Shrestha rohitsthaa

View GitHub Profile
@rohitsthaa
rohitsthaa / es_simple_autocomplete_example_config.sh
Created August 11, 2017 12:11 — forked from justinvw/es_simple_autocomplete_example_config.sh
Simple ElasticSearch autocomplete example configuration. The 'autocomplete' functionality is accomplished by lowercasing, character folding and n-gram tokenization of a specific indexed field (in this case "city").
# Delete the possibly existing autocomplete test index
curl -X DELETE localhost:9200/autocomplete_test
# Put the config of the autocomplete index
curl -X PUT localhost:9200/autocomplete_test -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

package google.material.com.listview;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="70dp"
android:weightSum="100"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20">
package google.material.com.listview;
/**
* Created by rohit on 10/26/15.
*/
public class Friend {
public String name;
public String image;
public String phonenumber;
public class City {
private Integer id;
private String name;
private Coord coord;
private String country;
private Integer population;
private Sys sys;
/**
@rohitsthaa
rohitsthaa / Acitivity_main.xml
Created October 20, 2015 11:06
Collapsing Toolbar Layout using Google Design Library
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context=".ScrollingActivity">
<android.support.design.widget.AppBarLayout android:id="@+id/app_bar"
android:fitsSystemWindows="true" android:layout_height="@dimen/app_bar_height"