- This is a collection of android snippets
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
DB.prototype.getCurrentOpStats = function() { | |
intervals = [1,5,10,30] | |
waitingForLock = 0; | |
secsRunningStats = {}; | |
inProg = db.currentOp()["inprog"] | |
inProg.forEach(function (op) { | |
if(op["waitingForLock"]) { | |
waitingForLock += 1; | |
} |
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
2015-04-11 09:47:23 +0900 | |
python | |
-c | |
import setuptools, tokenize | |
__file__ = 'setup.py' | |
exec(compile(getattr(tokenize, 'open', open)(__file__).read() | |
.replace('\r\n', '\n'), __file__, 'exec')) | |
--no-user-cfg | |
install |
- Settings - Editor - Live Templates
- Add Live Template or create a Template Group. Choose the Template Group option will create an .xml file with the same name of the Template Group you defined before.
- The .xml file can be found in a different folder, depends on the operating system.
Example:
Log.e(TAG,MESSAGE);
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
<templateSet group="android"> | |
<template name="focvb" value="@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_$END$, container, false); ButterKnife.inject(this, view); return view; } " description="Fragment onCreateView with ButterKnife" toReformat="true" toShortenFQNames="true"> | |
<context> | |
<option name="JAVA_CODE" value="false" /> | |
<option name="JAVA_STATEMENT" value="false" /> | |
<option name="JAVA_EXPRESSION" value="true" /> | |
<option name="JAVA_DECLARATION" value="true" /> | |
<option name="JAVA_COMMENT" value="false" /> | |
<option name="JAVA_STRING" value="false" /> | |
<option name="COMPLETION" value="false" /> |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
/* | |
* Copyright (C) 2013 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
int offset = computeVerticalScrollOffset(); | |
int range = computeVerticalScrollRange(); | |
int extent = computeVerticalScrollExtent(); | |
int leftoverExtent = range - offset - extent; | |
// In Case Items does not fill the screen (More accurate, if last | |
// Item is reachable from offset 0 | |
boolean isfillingScreen = getBottom() - height +yDelta< getHeight(); | |
// added line |
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
var Node = { | |
child: require('child_process'), | |
fs: require('fs'), | |
path: require('path') | |
}; | |
// This will be removed and then created and then removed: | |
var testdirectory = 'testfswatchmisses'; | |
if (Node.fs.remove !== undefined) throw new Error('fs.remove exists'); |
OlderNewer