Skip to content

Instantly share code, notes, and snippets.

@anujmiddha
anujmiddha / .vimrc
Last active October 29, 2021 12:49
vimrc
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'bling/vim-bufferline'
Plug 'scrooloose/nerdtree'
Plug 'elixir-editors/vim-elixir'
Plug 'slashmili/alchemist.vim'
Plug 'wincent/command-t'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
@anujmiddha
anujmiddha / app_and_api_template.rb
Last active November 2, 2021 06:55
A Rails application template to setup an app with Web and API end points
def user_model
file 'app/models/user.rb', <<-CODE
# frozen_string_literal: true
## User class
class User < ApplicationRecord
rolify
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
@anujmiddha
anujmiddha / bash_helpers.sh
Created March 19, 2020 11:21
Useful bash commands
Get the largest files and directories
$ du -a /var | sort -n -r | head -n 10
@anujmiddha
anujmiddha / application_helper.rb
Last active January 12, 2019 16:51
will_paginate custom LinkRenderer with Semantic UI
module ApplicationHelper
# change the default link renderer for will_paginate
def will_paginate(collection_or_options = nil, options = {})
if collection_or_options.is_a? Hash
options, collection_or_options = collection_or_options, nil
end
unless options[:renderer]
options = options.merge :renderer => SemanticUiLinkRenderer
end
@anujmiddha
anujmiddha / RecyclerViewAdapterTemplate.kt
Last active October 6, 2017 08:30
Android Studio Template for RecyclerViewAdapter
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}
#end
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
#parse("File Header.java")
@anujmiddha
anujmiddha / Android .gitignore
Created August 17, 2015 12:56
gitignore file for Android projects
# built application files
*.apk
*.ap_
# lint folder
lint
# files for the dex VM
*.dex
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
@anujmiddha
anujmiddha / gist:7b0d80a6ba141e29d61f
Created January 25, 2015 09:14
dokku database reset instructions
dokku postgresql:delete db-name
dokku postgresql:create db-name
dokku postgresql:link app-name db-name
dokku run app-name rake db:migrate
import android.content.*;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.provider.BaseColumns;
import android.text.TextUtils;
public abstract class BetterContentProvider extends ContentProvider {