Skip to content

Instantly share code, notes, and snippets.

View awgeezrick's full-sized avatar

Mark Jones awgeezrick

View GitHub Profile
@jaywilliams
jaywilliams / csv_to_array.php
Created April 30, 2010 23:18
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
i
me
my
myself
we
our
ours
ourselves
you
your
@evandrix
evandrix / pep20_by_example.py
Created March 13, 2012 18:45
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
@joshsmith
joshsmith / gist:2041454
Created March 15, 2012 02:49
Geoffrey Moore's positioning framework (for products)

Product Positioning Framework

  • For (target customers)
  • Who must (solve a specific problem)
  • Our product is a new (new product category)
  • That provides (key breakthrough benefit vs. current way of doing things – which solves dilemma)
  • Unlike (competitor in new category)
  • We have (whole product most relevant for you)
@NordomWhistleklik
NordomWhistleklik / fibonacci.py
Created October 11, 2012 17:09
[Python] Function for finding the nth number in a Fibonacci sequence
def get_fib(n, start):
'''(int, int) -> int
Returns the nth Fibonacci number where start defines whether the squence
starts at 0 or 1 and n is a whole number greater than or equal to 1
>>>get_fib(1,0)
0
>>>get_fib(1,1)
1
@damianesteban
damianesteban / war_game.py
Created October 9, 2013 04:14
python war card game oop
import random
################################################################################
def main():
table = Table(['Matthew', 'Mark', 'Luke', 'John'])
table.deal_cards()
table.play_all()
def print_underline(string, line):
@natelandau
natelandau / .bash_profile
Last active November 9, 2025 04:02
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@bsweger
bsweger / useful_pandas_snippets.md
Last active December 1, 2025 15:53
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@chris1610
chris1610 / pdf-report.py
Created February 16, 2015 22:29
PDF Report Generation - pbpython.com
"""
Generate PDF reports from data included in several Pandas DataFrames
From pbpython.com
"""
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
from jinja2 import Environment, FileSystemLoader
from weasyprint import HTML
@n0m4dz
n0m4dz / findLocalItems.js
Last active February 20, 2023 18:18 — forked from ungoldman/findLocalItems.js
how to filter keys from localStorage with a regex
// returns an array of localStorage items in key/value pairs based on a query parameter
// returns all localStorage items if query isn't specified
// query can be a string or a RegExp object
function findLocalItems (query) {
var i, results = [];
for (i in localStorage) {
if (localStorage.hasOwnProperty(i)) {
if (i.match(query) || (!query && typeof i === 'string')) {
value = JSON.parse(localStorage.getItem(i));