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
const pipeline_using_match_group = [ | |
// Stage 1: match the accounts with a balance greater than $1,000 | |
{ $match: { balance: { $lt: 1000 } } }, | |
// Stage 2: Calculate average balance and total balance | |
{ | |
$group: { | |
_id: "$account_type", | |
total_balance: { $sum: "$balance" }, | |
avg_balance: { $avg: "$balance" }, | |
}, |
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
public abstract TodoDao todoDao(); | |
//Create the WordRoomDatabase as a singleton to prevent having multiple instances of the database opened | |
//at the same time, which would be a bad thing | |
private static TodoDatabase INSTANCE; | |
public static final String DATABASE_NAME = "TASK_DATABASE"; | |
// singlton: to make sure there is no more than one copy | |
// @synchronized one thread only can deal with this database | |
public static synchronized TodoDatabase getInstance(Context context) { |
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
# Tip 1 | |
# to print all the interactive output, not only the last result. | |
from IPython.core.interactiveshell import InteractiveShell | |
InteractiveShell.ast_node_interactivity = "all" | |
################################################################################ | |
# Tips 2 | |
# get_option() / set_option() - get/set the value of a single option. | |
pd.get_option("display.max_rows") # return max_rows value |
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
# In your terminal, replace NOTEBOOK_NAME with the name of your notebook | |
jupyter nbconvert NOTEBOOK_NAME.ipynb --to slides --post serve | |
jupyter nbconvert NOTEBOOK_NAME.ipynb --to html |
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
{# Jupyter Notebook Toggle Template for Slides by Damian Avila | |
from http://www.damian.oquanta.info/posts/hide-the-input-cells-from-your-ipython-slides.html | |
#} | |
{%- extends 'slides_reveal.tpl' -%} | |
{% block input_group -%} | |
<div class="input_hidden"> | |
{{ super() }} | |
</div> |
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
# hiding code for proper presentation | |
from IPython.display import HTML | |
HTML('''<script> | |
code_show=true; | |
function code_toggle() { | |
if (code_show){ | |
$('div.input').hide(); | |
} else { | |
$('div.input').show(); | |
} |