Skip to content

Instantly share code, notes, and snippets.

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;
}
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
@hyuni
hyuni / android snippets.md
Last active September 15, 2015 06:12 — forked from fuhoi/ android snippets.md
Android Snippets

ANDROID SNIPPETS

  • This is a collection of android snippets
@hyuni
hyuni / liveTemplates.md
Last active September 15, 2015 06:12 — forked from marcjubero/liveTemplates.md
Android Studio - Live Templates

Android Studio - Live Templates

Using Settings panel:

  • 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);
@hyuni
hyuni / android.xml
Last active September 15, 2015 06:12 — forked from bolot/android.xml
A few live templates for Android Studio. On my Mac, this file lives in `~/Library/Preferences/AndroidStudioPreview1.3/templates/android.xml`. The location of the file depends on the version of Android Studio and the type of the operating system.
<templateSet group="android">
<template name="focvb" value="@Override&#10;public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {&#10; View view = inflater.inflate(R.layout.fragment_$END$, container, false);&#10; ButterKnife.inject(this, view);&#10; return view;&#10;}&#10;" 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" />
@hyuni
hyuni / mobile_development.md
Last active September 15, 2015 06:15 — forked from carocad/mobile_development.md
General overview of the most prominent Operating systems for Smartphones and Frameworks available for cross-platform development

Smartphones app-development overview - as of 06.2015

Marketshare

Global marketshare

Smartphones operating systems overview

Android - Google

  • License:
    • OS: Apache v2
  • kernel: LGPL v3
@hyuni
hyuni / 0_reuse_code.js
Created September 30, 2015 02:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@hyuni
hyuni / ExpandingListView
Created November 10, 2015 12:24 — forked from sh0rtshift/ExpandingListView
Fixes for Daniel Olshansky's DevByte example "ListView Expanding Cells Animation" (lines 130-132), also adds compatibility back to API 11. http://www.youtube.com/watch?v=mwE61B56pVQ http://developer.android.com/shareables/devbytes/ListViewExpandingCells.zip Fixes include using ViewCompat for v.hasTransientState() Hacks for getTopAndBottomTransla…
/*
* 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
@hyuni
hyuni / ExpendingListView
Created November 10, 2015 12:25 — forked from sharoni474/ExpendingListView
A fix for Daniel Olshansky's DevByte example "ListView Expanding Cells Animation"- collapsing part, when last item is visible from top
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
@hyuni
hyuni / test-watch.js
Last active December 19, 2015 12:17 — forked from jorangreef/test-watch.js
Test the reliability and average and max latency of the underlying OS notification system used by Node's fs.watch. Uses fsync to flush the filesystem cache to make sure these don't delay notifications (this makes little to no difference).
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');