Skip to content

Instantly share code, notes, and snippets.

@peterlozano
peterlozano / Readme.md
Last active August 29, 2015 14:05
D3.js + Angular.js Demo.

Demo of how to create an Angular.js directive which provides a d3.js visualization.

The data used by the visualisation is provided by a controller and is synced by Angular.

@mbostock
mbostock / .block
Last active July 30, 2017 21:01
Quicksort IV
license: gpl-3.0
@natelandau
natelandau / .bash_profile
Last active April 30, 2024 18:07
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
@bennadel
bennadel / preload-images.htm
Created March 27, 2014 11:55
Preloading Images In AngularJS With Promises
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Preloading Images In AngularJS With Promises
</title>
</head>
<body ng-controller="AppController">
@clayzermk1
clayzermk1 / README.md
Last active October 23, 2019 22:47
spacetime

A representation of the current time of year using the Sun, Earth, and Moon.

The position of the Earth in orbit around the Sun indicates the hour of year. The Earth itself is a pie chart indicating the second of day. The Moon's position in orbit around the Earth indicates the hour of month. The time is updated every second.

CodePen demo

Copyright 2014 Clay Walker
MIT License

@frontendbeast
frontendbeast / gist:7188558
Last active March 5, 2016 13:53
Craft CMS future events listings, sorted by date and grouped by month and year. Requires Danny Nimmo's SortByField plugin. https://github.com/dannynimmo/craftcms-sortbyfield
{% set allEvents = craft.entries.section('events').find() %}
{% set futureEvents = [] %}
{% for event in allEvents %}
{% if event.startDate | date('U') >= 'now' | date('U') %}
{% set futureEvents = futureEvents | merge([event]) %}
{% endif %}
{% endfor %}
{% for date, events in futureEvents | sortByField('startDate') | group('startDate|date("F Y")') %}
@jslegers
jslegers / style.scss
Created July 26, 2013 13:24
A CodePen by Hugo Giraudel. Sass mixin for scrollbar styling - Because I can't ever remember the right syntax for scrollbars styling in WebKit, here is a little Sass mixin to do it for you.
@import "compass";
/**
* Mixin scrollbar
*/
@mixin scrollbar($size, $primary, $secondary: lighten($primary, 25%)) {
::-webkit-scrollbar {
width: $size;
height: $size;
}
@fnicollet
fnicollet / gist:5764080
Created June 12, 2013 09:50
Single tile WMS layer for Leaflet. Kind of hacked on top of ImageOverlay, a new image is requested when the viewport is changed. Supports reprojection through proj4-leaflet There are actually 2 images (_image and _imageSwap) because if you use the _image from ImageOverlay, and set his "src" attribute to the new WMS bbox, your layer will disappea…
goog.provide('L.SingleTileWMSLayer');
goog.require('L.Map');
L.SingleTileWMSLayer = L.ImageOverlay.extend({
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
version: '1.1.1',
@miguelgrinberg
miguelgrinberg / rest-server.py
Last active March 29, 2024 09:05
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@djvanderlaan
djvanderlaan / index.html
Last active March 1, 2023 02:58
Planetarium
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
.orbit {
stroke : #000000;