Skip to content

Instantly share code, notes, and snippets.

Python 101

Generators

This is a generator statement:

[ a['name'] for a in actors if a['born'] < datetime.datetime(1976, 1, 1) ]

A generator iterates on a set of data and can select out modified components, sometimes based on criteria. In this case, this code lists out actors from an array of actor dictionaries where the actor was born before 1976.

@krasnopolsky
krasnopolsky / Default.aspx
Created November 2, 2015 21:56
.NET Webforms Example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" enableEventValidation="false" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
#card-number
{
@jefffriesen
jefffriesen / README.md
Last active May 2, 2024 15:11
US Zip Codes

This is a d3.js visualization of US zip codes.

Original zip code dataset from Geocommons.

5MB shapefile with properties such as zipcode, state, name, population, area, more.

http://geocommons.com/overlays/54893 (Thank you Bill Greer)

This converts it nicely:

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: