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.

package tank;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.util.concurrent.TimeUnit;
import javax.swing.JFrame;
import javax.swing.JPanel;
@darrenjaworski
darrenjaworski / functions.php
Last active February 15, 2016 17:46
use custom field suite with wp-api
<?php
add_action( 'rest_api_init', 'example_add_cfs' );
/**
* Add cfs fields to api call for post type example
* Fields will be put in cfs object in json
* @param none
*
* @return null
@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;
}
@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">
@mbostock
mbostock / .block
Last active July 30, 2017 21:01
Quicksort IV
license: gpl-3.0
@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',
@rduplain
rduplain / responsive_d3_example.html
Created April 18, 2012 14:55 — forked from mattalcock/responsive_d3_example.html
Responsive d3.js D3 Javascript Histogram Example
<!DOCTYPE html>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
body {
font: 10px sans-serif;
}
rect {
@lkopacz
lkopacz / index.html
Last active May 15, 2019 17:05
Semantic HTML buttons
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title of the document</title>
</head>
<body>
<!--This doesn't work when you press Enter and
there's a click event -->
<div id="button-1" role="button" tabindex="0">
Open