This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; (add-to-list 'load-path "~/.emacs.d/elpa") | |
(setq make-backup-files nil) ; stop creating backup~ files | |
(setq auto-save-default nil) ; stop creating #autosave# files | |
;; (require 'package) | |
;; (add-to-list | |
;; 'package-archives | |
;; '("melpa" . "http://melpa.org/packages/") | |
;; t) | |
;; (add-to-list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
alias git=hub | |
PATH=$PATH:/usr/local/bin | |
# android path (installed via homebrew) | |
PATH=$PATH:/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools | |
PATH=$PATH:/usr/local/Cellar/android-sdk/24.4.1_1/tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.android.volley.NetworkResponse; | |
import com.android.volley.ParseError; | |
import com.android.volley.Response; | |
import com.android.volley.toolbox.HttpHeaderParser; | |
import com.android.volley.toolbox.StringRequest; | |
import java.io.BufferedReader; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
/** | |
* @author Prem Nirmal | |
*/ | |
public class XORCrypt { | |
static String value = "SampleStringToBeEncrypted"; | |
static String keyval = "thisIsAKey"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
escape ^\\\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.squareup.moshi.Json | |
/** | |
* Class representing a recipe's nutritional information. | |
* The [calories_per_serving] field does not include the correct annotation for Moshi to be able to parse it. | |
*/ | |
data class NutritionalInfoNet( | |
@JvmField | |
var id: String, | |
@JvmField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.squareup.moshi.Json | |
/** | |
* Class representing a recipe's nutritional information. | |
* The [calories_per_serving] field here includes the correct annotations for Moshi to be able to parse it. | |
*/ | |
data class NutritionalInfoNet( | |
@JvmField | |
var id: String, | |
@JvmField |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrowseRecipesFragment : Fragment(), View.OnClickListener { | |
private var recipeClickListener: RecipeClickListener? = null | |
... | |
override fun onAttach(context: Context) { | |
super.onAttach(context) | |
recipeClickListener = context as RecipeClickListener | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Delegate that sets and disposes the fragment's listener by casting it to the fragment's activity. | |
*/ | |
class ParentActivityDelegate<T>(fragment: Fragment) : BaseParentDelegate<T>(fragment) { | |
override fun extractValue(fragment: Fragment): T? = fragment.activity as? T | |
} | |
/** | |
* Delegate that sets and disposes the fragment's listener by casting it to the fragment's |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrowseRecipesFragment : Fragment(), View.OnClickListener { | |
private val recipeClickListener: RecipeClickListener by ParentActivityDelegate(this) | |
... | |
override fun onClick(v: View) { | |
// Guaranteed to be not null :) | |
recipeClickListener.onRecipeClicked(recipe) | |
} |
OlderNewer