Skip to content

Instantly share code, notes, and snippets.

View oscarmcm's full-sized avatar
🐍
Pythonista

Oscar Cortez oscarmcm

🐍
Pythonista
View GitHub Profile
@oscarmcm
oscarmcm / settings.json
Last active June 30, 2021 21:35
My VSCODE Settings
{
"editor.minimap.enabled": false, // removes minimap
"editor.fontLigatures": true,
"disableLigatures.mode": "Cursor",
"editor.fontSize": 14.0,
"editor.rulers": [79],
"editor.fontFamily": "JetBrains Mono",
"editor.renderWhitespace": "none", // removes whitespace chars
"editor.renderIndentGuides": false, // removes indent guides
"editor.renderLineHighlight": "none", // removes line highlight
@oscarmcm
oscarmcm / py.md
Last active October 15, 2020 21:08 — forked from jph00/py.md
Organized and hyperlinked index to every module, function, and class in the Python standard library

All of the python 3.9 standard library

For a version without the collapsible details sections (so you can search the whole thing in your browser), click here.

@oscarmcm
oscarmcm / middleware.py
Created August 16, 2019 17:17
Make Turbolinks know about redirects in Django
# Taken from: https://github.com/dgladkov/django-turbolinks/blob/master/turbolinks/middleware.py#L11 # NOQA
def same_origin(current_uri, redirect_uri):
a = urlparse(current_uri)
if not a.scheme:
return True
b = urlparse(redirect_uri)
return (a.scheme, a.hostname, a.port) == (b.scheme, b.hostname, b.port)
class TurbolinksMiddleware(object):
@oscarmcm
oscarmcm / vs.css
Last active February 26, 2019 17:09
VS CSS Fixes
.monaco-workbench .sidebar>.content {
padding-top: 10px;
padding-left: 20px;
padding-right: 20px;
}
.monaco-tl-twistie.collapsible.collapsed:not(.loading) {
margin-top: 10px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none'%3E%3Crect x='0' y='0' width='11' height='11' rx='1.5' fill='%23fff'%3E%3C/rect%3E%3Crect x='1' y='1' width='9' height='9' rx='1.5' stroke='%23333'%3E%3C/rect%3E%3Cline x1='3.5' y1='5.5' x2='7.5' y2='5.5' stroke='%23333'%3E%3C/line%3E%3Cline x1='5.5' y1='3.5' x2='5.5' y2='7.5' stroke='%23333'%3E%3C/line%3E%3C/svg%3E") !important;
}
@oscarmcm
oscarmcm / pyenv+virtualenv.md
Created January 7, 2017 05:30 — forked from eliangcs/pyenv+virtualenv.md
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv
var nodes = document.querySelectorAll('.day');
var items = ['#d6e685', '#8cc665', '#44a340', '#1e6823']
Array.prototype.randomElement = function () {
return this[Math.floor(Math.random() * this.length)]
}
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].getAttribute('fill') == '#eeeeee') {
@oscarmcm
oscarmcm / category.html
Created June 22, 2015 22:48
Liquid template for display post categories
<ul class="tag-box inline">
{% assign tags_list = site.categories %}
{% if tags_list.first[0] == null %}
{% for tag in tags_list %}
<li><a href="#{{ tag }}">{{ tag | capitalize }} <span>{{ site.tags[tag].size }}</span></a></li>
{% endfor %}
{% else %}
{% for tag in tags_list %}
<li><a href="#{{ tag[0] }}">{{ tag[0] | capitalize }} <span>{{ tag[1].size }}</span></a></li>
{% endfor %}
@oscarmcm
oscarmcm / render.py
Created May 22, 2015 22:13
Simple Django Template Tag that render another template tag added in a text field
# -*- coding: utf-8 -*-
from django import template
from django.template.context import Context
from django.template.defaultfilters import stringfilter
from django.template.loader import get_template_from_string
register = template.Library()
@register.filter
@oscarmcm
oscarmcm / pagination.html
Created April 27, 2015 03:25
A Django template tag for pagination
{% load i18n %}
<div class="row">
<div class="col-xs-12">
<section class="paginator text-center">
<nav>
<ul class="pagination">
<li>
{% if page.has_previous %}
<a href="?page={{ page.previous_page_number }}" aria-label="Previous">
@oscarmcm
oscarmcm / hulu.zsh-theme
Created March 23, 2015 21:09
It's my custom therminal theme for oh-my-zsh
# Clean, simple, compatible and meaningful.
# Terminal command status
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
# Terminal current folder
local current_folder="%{$fg[cyan]%}%c"
# Machine name.
function machine_name {