Skip to content

Instantly share code, notes, and snippets.

View ungarst's full-sized avatar

Dave Carpenter ungarst

View GitHub Profile
@ungarst
ungarst / case_insensitive_unique_list.py
Last active August 29, 2015 14:01
Case Insensitive Unique List
def unique_list(list):
u_list = []
[u_list.append(x) for x in list if x.lower() not in [y.lower() for y in u_list]]
return u_list
print (unique_list(["Welcome", "to", "COMPSCI101", "to", "wELcome"]))
# BETTER VERSION!!!
@ungarst
ungarst / application.html.erb
Created May 18, 2013 00:08
Rails not including all CSS
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<solid android:color="#00CCCCCC" />
</shape>
</item>
@ungarst
ungarst / gist:5150263
Created March 13, 2013 08:34
The moves seed method in board
public boolean moveSeeds(int playerToMove, int houseNumber) {
int seedsInHand, currentPlayer, currentHouse;
if (_players[playerToMove].seedsInHouse(houseNumber) == 0) {
}
// get seeds from players house
// number of seeds
// set seeds in that house to be zero
@ungarst
ungarst / gist:4108297
Created November 19, 2012 00:10
You said you wanted it rfw
#!/usr/bin/python
import sys
import re
class Submission(object):
def __init__ (self, lines):
self.info = lines[0]
start = 2