Skip to content

Instantly share code, notes, and snippets.

---
title: "Hey, what a weird way to set titles"
date: 2017-05-24 15:00:00
categories:
tags:
---
I'm gonna try some stuff!
<div id="chart"></div>
<style>
html {
font-size: 62.5% !important; }
body {
font-size: 1.8em !important; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.6 !important;
font-weight: 200 !important;
color: #222 !important; }
@mattlewissf
mattlewissf / jupyter.css
Last active May 2, 2017 20:36
Jupyter Notebook CSS
<style>
html {
font-size: 62.5% !important; }
body {
font-size: 1.5em !important; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.6 !important;
font-weight: 400 !important;
font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
color: #222 !important; }
@mattlewissf
mattlewissf / class_def.py
Created September 7, 2016 14:18
Dynamic class creation example
# written and discarded in favor of sqlalchemy methods - still a good example of how to dynamically create classes in Python
import glob
import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.dialects.mysql import TIMESTAMP
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
import pandas as pd
@mattlewissf
mattlewissf / digit_recognizer_1.py
Created August 23, 2016 21:26
Kaggle | Digit Recognizer
""" First attempt at Kaggle Digit Recognizer | https://www.kaggle.com/c/digit-recognizer/
Basic approach w/ random trees results in 0.96486 accuracy
"""
import pandas as pd
import numpy as np
from numpy import savetxt
from sklearn.ensemble import RandomForestClassifier
@mattlewissf
mattlewissf / prime_gaps.py
Created August 6, 2016 20:42
prime_gaps.py
import unittest
def gap(g,m,n):
primes = []
# finds primes in range
for num in xrange(m,n+1,1): # n to be included in range
x_half = num / 2
is_prime = all(num % x != 0 for x in xrange(2,x_half+1,1))
if is_prime == True:
lambda x: -683.923549636
lambda x: -116.783533207 * (-(x[6] - -5.1676818541) if x[6] <= -5.41238626298 else 0 if x[6] >= -4.67412019866 else (-0.007619371398 * (x[6] - -4.67412019866) ** 2 + -0.61845994042 * (x[6] - -4.67412019866) ** 3))
lambda x: -29.1588158614 * (0 if x[6] <= -0.137738977403 else (x[6] - 0.751892264604) if x[6] >= 1.25162817331 else (0.0569021591939 * (x[6] - -0.137738977403) ** 2 + 0.145377420148 * (x[6] - -0.137738977403) ** 3)) * (0 if x[6] <= -5.41238626298 else (x[6] - -5.1676818541) if x[6] >= -4.67412019866 else (1.36214458707 * (x[6] - -5.41238626298) ** 2 + -0.61845994042 * (x[6] - -5.41238626298) ** 3))
lambda x: 28.2353765603 * (-(x[6] - 0.751892264604) if x[6] <= -0.137738977403 else 0 if x[6] >= 1.25162817331 else (0.662849995222 * (x[6] - 1.25162817331) ** 2 + 0.145377420148 * (x[6] - 1.25162817331) ** 3)) * (0 if x[6] <= -5.41238626298 else (x[6] - -5.1676818541) if x[6] >= -4.67412019866 else (1.36214458707 * (x[6] - -5.41238626298) ** 2 + -0.61845994042 * (x[6] - -5.412386
@mattlewissf
mattlewissf / gist:15e074c45e6809fffd11
Created June 12, 2014 00:38
Awesome Sublime Text 2 configuration
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 0,
"bold_folder_labels": true,
"caret_style": "wide",
@mattlewissf
mattlewissf / mustache.md
Last active August 29, 2015 13:58
Mustache!

HTML templates decouple the UI definition (HTML markup) from the data. If you develop or plan to develop JavaScript applications, you should use a JavaScript client-side templating engine to keep your JavaScript and HTML sufficiently decoupled, which will allow you to manage your HTML and JS files reliably and easily.

Mustache is a logic-less template syntax. It can be used for HTML, config files, source code - anything. It works by expanding tags in a template using values provided in a hash or object.

We call it "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values.

You pass your data as an object (a regular JavaScript object) to the Handlebars function. The data object is called the context. And this object can be comprised of arrays, strings, numbers, other objects, or a combination of all of these.

Most developers that are not aware of template systems create new chunks

@mattlewissf
mattlewissf / add-p.md
Last active June 14, 2024 06:08
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p