Skip to content

Instantly share code, notes, and snippets.

Avatar
🌠
Coding in the MultiVerse

Nishant Srivastava nisrulz

🌠
Coding in the MultiVerse
View GitHub Profile
@nisrulz
nisrulz / AwesomeLibMain.java
Created Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: AwesomeLibMain class after lifecycle components have been integrated
View AwesomeLibMain.java
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.OnLifecycleEvent;
public class AwesomeLibMain implements LifecycleObserver {
static final AwesomeLibMain ourInstance = new AwesomeLibMain();
public static AwesomeLibMain getInstance() {
return ourInstance;
}
@nisrulz
nisrulz / MainActivity.java
Created Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: MainActivity class
View MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Init
AwesomeLibMain.getInstance().init();
}
@nisrulz
nisrulz / AwesomeLibMain.java
Last active Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: AwesomeLibMain class
View AwesomeLibMain.java
public class AwesomeLibMain {
static final AwesomeLibMain ourInstance = new AwesomeLibMain();
public static AwesomeLibMain getInstance() {
return ourInstance;
}
private AwesomeLibMain() {
}
@nisrulz
nisrulz / pr.md
Created Jul 28, 2017 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@nisrulz
nisrulz / loadcsv2dataframe.py
Created Jun 9, 2017
Read and load a csv file into pandas data frame
View loadcsv2dataframe.py
import pandas as pd
import csv
with open("<filename>.csv", 'r') as f:
with open("updated_file.csv", 'w') as f1:
f.next() # skip header line
f.next() # skip header empty line
for line in f:
f1.write(line.replace('\x00', ''))
View android_material_design_colours.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@nisrulz
nisrulz / ZentonePrivacyPolicy.html
Last active Mar 5, 2017
Privacy Policy for Zentone
View ZentonePrivacyPolicy.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Privacy Policy - Zentone</title>
<style>
body{
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
@nisrulz
nisrulz / FlashlightPrivacyPolicy.html
Last active Mar 5, 2017
Privacy Policy for Flashlight
View FlashlightPrivacyPolicy.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Privacy Policy - Flashlight (IntelliSense Tech)</title>
<style>
body{
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
@nisrulz
nisrulz / PackageHunterPrivacyPolicy.html
Last active Mar 5, 2017
Privacy Policy for PackageHunter
View PackageHunterPrivacyPolicy.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Privacy Policy - PackageHunter</title>
<style>
body{
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
@nisrulz
nisrulz / EasyDeviceInfoPrivacyPolicy.html
Last active Mar 4, 2017
Privacy Policy for EasyDeviceInfo
View EasyDeviceInfoPrivacyPolicy.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Privacy Policy - EasyDeviceInfo</title>
<style>
body{
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;