Skip to content

Instantly share code, notes, and snippets.

@ucyo
Last active August 15, 2019 10:10
Show Gist options
  • Select an option

  • Save ucyo/654fa96d399c1e653942e5a17e3f305f to your computer and use it in GitHub Desktop.

Select an option

Save ucyo/654fa96d399c1e653942e5a17e3f305f to your computer and use it in GitHub Desktop.
snippets
{
// Place your snippets for latex here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Add a todo": {
"prefix": "todo",
"body": [
"% TODO: $1",
],
"description": "Add a todo"
},
"New acronym": {
"prefix": "\\newacronym",
"body": [
"\\newacronym{$1}{$2}{$3}"
],
"description": "Add a new acronym"
},
"Italic text": {
"prefix": "\\it",
"body": [
"\\textit{$1} $0"
],
"description": "italic text"
},
"Verbatim text": {
"prefix": "\\tt",
"body": [
"\\texttt{$1} $0"
],
"description": "verbatim text"
},
"Bold text": {
"prefix": "\\bf",
"body": [
"\\textbf{$1} $0"
],
"description": "bold text"
},
"Add table": {
"prefix": "\\table",
"body": [
"\\begin{table}",
" \\caption[$1]{$1 $2}",
" \\label{tab:$3}",
" \\centering\\CaptionFontSize",
" \\begin{tabular}{@{}ccc@{}}",
" \\toprule",
" $4 & $5 & $6 \\\\\\",
" \\bottomrule",
" \\end{tabular}",
"\\end{table}",
"$0"
],
"description": "Add table"
},
"Add figure": {
"prefix": "\\figure",
"body": [
"\\begin{figure}",
" \\centering\\CaptionFontSize",
" \\includegraphics[width=$1\\linewidth]{Figures/$2}",
" \\caption[$3]{$3 $4}",
" \\label{fig:$2}",
"\\end{figure}",
"$0"
],
"description": "Add figure"
},
"Add equation": {
"prefix": "\\equation",
"body": [
"\\begin{equation}",
" \\label{eq:$1}",
" $2",
"\\end{equation}",
"$0"
],
"description": "Add equation"
},
"Add algorithm": {
"prefix": "\\algorithm",
"body": [
"\\begin{algorithm}",
" \\caption[$1]{$1 $2}",
" \\label{alg:$3}",
" \\begin{algorithmic}[1]",
" \\Procedure{$4}{$5}",
" \\State \\textbf{return} $6",
" \\EndProcedure",
" \\end{algorithmic}",
"\\end{algorithm}",
"$0"
],
"description": "Add algorithm"
},
"Add subfigures": {
"prefix": "\\subfigure",
"body": [
"\\begin{figure}[t]",
"\\begin{subfigure}[b]{.49\\linewidth}",
" \\centering\\CaptionFontSize",
" \\includegraphics[width=1\\linewidth]{$1}",
" \\caption{$1 $2}",
" \\label{fig:$3}",
"\\end{subfigure}%",
"\\hfill",
"\\begin{subfigure}[b]{.49\\linewidth}",
" \\centering\\CaptionFontSize",
" \\includegraphics[width=1\\linewidth]{$4}",
" \\caption{$4 $5}",
" \\label{fig:$6}",
"\\end{subfigure}%",
"\\caption{$7}",
"\\label{fig:$8}",
"\\end{figure}",
],
"description": "Add subfigures"
},
}
{
// Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Python Header": {
"prefix": "head",
"body": [
"#!/usr/bin/env python",
"# coding: utf-8",
"\"\"\"",
"$1",
"\"\"\"",
"$2",
],
"description": "Header for python files"
},
"Data Science": {
"prefix": "imports",
"body": [
"import numpy as np",
"import pandas as pd",
"from matplotlib import pyplot as plt",
"import seaborn as sns",
],
"description": "Usual imports for scientific working"
},
"todo": {
"prefix": "todo",
"body": [
"# TODO: ${0}",
],
"description": "Add a todo note"
},
"If/Main": {
"prefix": "ifmain",
"body": [
"if __name__ == '__main__':",
" main()",
"$0"
]
}
}
{
// Place your snippets for rust here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Add a todo": {
"prefix": "todo",
"body": [
"// TODO: $1",
"$0"
],
"description": "Add a todo note"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment