Skip to content

Instantly share code, notes, and snippets.

View felton's full-sized avatar
🦆
undefined

felton

🦆
undefined
View GitHub Profile
@felton
felton / venv_wrapper
Created May 20, 2019 15:06 — forked from dbtek/venv_wrapper
Python 3 venv wrapper. Manages all virtual environments under ~/.venv/ .
# include following in .bashrc / .bash_profile / .zshrc
# usage
# $ mkvenv myvirtualenv # creates venv under ~/.venv/
# $ venv myvirtualenv # activates venv
# $ deactivate # deactivates venv
# $ rmvenv myvirtualenv # removes venv
export VENV_HOME="$HOME/.venv"
[[ -d $VENV_HOME ]] || mkdir $VENV_HOME
@felton
felton / babyql.php
Created October 18, 2018 15:22
👶GraphQL
<?php
/**
* To start, run:
* composer require guzzlehttp/guzzle
* Then:
* php babyql.php
*/
require 'vendor/autoload.php';
@felton
felton / .gitignore
Created May 19, 2013 16:18
Multiplatform .gitignore, put together from the github/gitignore project
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
@felton
felton / tinyxml2_parse.cpp
Last active December 17, 2015 01:39
Parsing XML with TinyXML2
/**
____ _
| _ \ __ _ _ __ ___(_)_ __ __ _
| |_) / _` | '__/ __| | '_ \ / _` |
| __/ (_| | | \__ \ | | | | (_| |
|_| \__,_|_| |___/_|_| |_|\__, |
|___/
_______ _ __ ____ __ _ ____
__ __/ /_ _(_)_ __ _ _\ \/ / \/ | | |___ \
\ \ /\ / / / | | | | '_ \| | | |\ /| |\/| | | __) |
@felton
felton / gist:4242635
Created December 9, 2012 00:03 — forked from statico/gist:3172711
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@felton
felton / gist:3990631
Created October 31, 2012 23:30 — forked from artgon/gist:1361497
Post previews for Github Pages (a la wordpress)
{% for post in site.posts limit:5 %}
<div class="box">
<h3>{{post.title}}</h3>
<div class="clearfix"></div>
<div class="right big">
{% assign breakIndex = -1 %}
{% for element in post.content %}
{% if element contains '<!--more-->' %}
{% assign breakIndex = forloop.index %}
{% endif %}

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@felton
felton / tree.md
Created April 24, 2012 04:03 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@felton
felton / get-github-wiki.rb
Created February 13, 2012 16:38 — forked from manveru/get-github-wiki.rb
Download github wikis
require 'open-uri'
require 'hpricot'
user, project = ARGV # 'tobi', 'liquid'
fail "get-github-wiki <username> <projectname>" unless user and project
uri = "http://wiki.github.com/#{user}/#{project}"
xpath = "div.sidebar/ul[1]//a"
command = %w[wget -t 2 -mkc --no-parent]
@felton
felton / SDLMain.h
Created January 22, 2012 05:38
SDLMain Header File
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#ifndef _SDLMain_h_
#define _SDLMain_h_