Dan Walin and John Papa.
We use components to figure parts / sections of our single-page apps.
Imports are awesome because we don't worry about ordering any more. They also help compress our js files.
| class asobj(object): | |
| """ | |
| Convert a python dictionary to an object accessible as attributes. | |
| Args: | |
| d: a python dictionary | |
| Returns: | |
| object: a python object with keys as attributes | |
| """ | |
| def __init__(self, d): |
| #!/usr/bin/python | |
| """ | |
| This stupid function produces randomly capitalized text for usage in the | |
| god-awful spongebob meme. | |
| I can't believe I've done this. | |
| """ | |
| import random |
| #!/usr/bin/python | |
| """ | |
| Command line utilities to help start a clean boilerplate project | |
| Requirements: | |
| - Click command line: `pip install Click` | |
| Examples taken from https://www.svds.com/jupyter-notebook-best-practices-for-data-science/ # noqa |
| #!/bin/bash | |
| # export DBUS_SESSION_BUS_ADDRESS environment variable because cron hates me | |
| PID=$(pgrep -u USER gnome-session-b) | |
| export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-) | |
| /usr/bin/gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Plat' | |
| /usr/bin/gsettings set org.gnome.desktop.interface gtk-theme 'Flat-Plat' | |
| /usr/bin/gsettings set org.gnome.desktop.background picture-uri 'file://WALLPAPER-PATH' | |
| /usr/bin/gsettings --schemadir ~/.local/share/gnome-shell/extensions/[email protected] set org.zzrough.gs-extensions.drop-down-terminal background-color 'rgb(69,90,100)' |
| # List unique values in a DataFrame column | |
| pd.unique(df.column_name.ravel()) | |
| # Convert Series datatype to numeric, getting rid of any non-numeric values | |
| df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True) | |
| # Grab DataFrame rows where column has certain values | |
| valuelist = ['value1', 'value2', 'value3'] | |
| df = df[df.column.isin(valuelist)] |
I hereby claim:
To claim this, I am signing this object:
| from django.contrib.gis.measure import D | |
| from django.contrib.gis.geos import Point | |
| SRID = 4326 | |
| pnt = Point(lat, lon, srid=SRID) | |
| class Location(models.Model): | |
| point = models.PointField() | |
| objects = models.GeoManager() | |
| campuses = Location.objects.filter( |
| angular.module('BasicModule', []) | |
| .config(['$httpProvider', function($httpProvider) { | |
| $httpProvider.defaults.useXDomain = true; | |
| delete $httpProvider.defaults.headers.common['X-Requested-With']; | |
| } | |
| ]) | |
| .controller('BasicCtrl', function BasicCtrl($http){ | |
| var basic = this; | |
| basic.events_api_url = "https://gdata.youtube.com/feeds/api/videos/?v=2&alt=json"; |
| # -*- coding: utf-8 -*- | |
| import random | |
| members = [ | |
| "programmer 1", | |
| "programmer 2" | |
| ] | |
| print("Winner: {member}".format( |