Skip to content

Instantly share code, notes, and snippets.

View bentranter's full-sized avatar

Ben Tranter bentranter

View GitHub Profile
;
; RULES
;
; Basic person template
;
(deftemplate person
(slot name)
(slot age)
(slot gender (allowed-symbols male female other))
//
// These are used to generate equilateral or isoceles triangles.
//
// @param {int-px} distance from top of div
// @param {int-px} height of triangle
// @param {int-px} width of triangle
// @param {colour-hex} color of triangle
//
//
<!-- Make the Kirby -->
<!-- For an exmaple, see http://codepen.io/bentranter/pen/QwWNrx -->
<div class="kirby">
<div class="left-arm"></div>
<div class="right-arm"></div>
<div class="left-eye">
<div class="left-eye-white"></div>
<div class="left-eye-shimmer"></div>
//
// Style the Kirby - don't change anything but the variables
//
// For an example, see http://codepen.io/bentranter/pen/QwWNrx
//
// Variables - hopefully verbose enough!
//
$kirby : 300px;
@bentranter
bentranter / index.html
Created March 11, 2015 23:09
Render templates from a collection using Exoskeleton and Microtemplate
<script id='itemTemplate' type='text/template'>
<li><%= someValue %></li>
</script>
<ul id='item'></ul>
(function() {
'use strict';
function BenTranter() {
this.contactInfo = {
positon: 'Front-End Dev',
email : '[email protected]',
phoneNo: 8076213561
};
this.education = {
@bentranter
bentranter / README.md
Last active August 29, 2015 14:21
Thinky Schema Example

Possible error in the Thinky docs at the post example. It says that createdAt should be type.string().default(r.now()), but I think it's supposed to say type.date().default(r.now()).

See the code below for an example, it should throw an error because of line 19.

@bentranter
bentranter / user-agent-stylesheet.css
Created July 27, 2015 21:55
Chrome 44 User Agent Stylesheet Excerpt - I never knew it did this kind of stuff
/**
* h1 has different defaults depending on what the h1 element
* is in.
*/
h1 {
display: block;
font-size: 2em;
-webkit-margin-before: 0.67em;
-webkit-margin-after: 0.67em;
@bentranter
bentranter / hell.go
Last active August 29, 2015 14:27
What scraping HTML is like
// This could be you if you choose to scrape HTML
for _, article := range articles {
fmt.Printf("\033[33m%s\033[0m - \033[32mTitle: %s\033[0m\nDescription: %s\n\033[36mhttp://kijiji.ca%s\033[0m\n\n", scrape.Text(article.NextSibling.NextSibling), scrape.Text(article.FirstChild.NextSibling), scrape.Text(article), scrape.Attr(article.FirstChild.NextSibling, "href"))
}
@bentranter
bentranter / sometimes_concurrency_is_good.go
Last active September 3, 2015 16:37
Async vs. Sync HTTP requests
// This tries to show the difference between async and sync
// HTTP GET requests. Big surprise: its way faster do this
// async...
package main
import (
"fmt"
"github.com/bentranter/chalk"
"net/http"
"time"