Skip to content

Instantly share code, notes, and snippets.

View gist:2a6768d263ae3927ab630a7d4dbcf00d
---
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>
View skeleton.css
<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
Jupyter Notebook CSS
View jupyter.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 Sep 7, 2016
Dynamic class creation example
View class_def.py
# 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 Aug 23, 2016
Kaggle | Digit Recognizer
View digit_recognizer_1.py
""" 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
View 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:
View gist:e1fa4b6ffc3ca906f44f7b0cb9db0e8d
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 Jun 12, 2014
Awesome Sublime Text 2 configuration
View gist:15e074c45e6809fffd11
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 0,
"bold_folder_labels": true,
"caret_style": "wide",
View mustache.md

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 Sep 18, 2021
Lightning Talk: Git add -p
View add-p.md

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