Skip to content

Instantly share code, notes, and snippets.

#![macro_escape]
/**
* Create a new T with default values.
* usage:
*
* let x:T = default!();
* let x = default!(Foo, x:1);
* let x = default!(Foo);
*/
<!-- hello-flomp component -->
<link rel="import" href="hello-gallery.html"/> <!-- Oo, we're using a subcomponent -->
<template id="hello_flomp"> <!-- Look a designer friendly template -->
<style> <!-- With encapsulated styles.... -->
hello-flomp > div {
border : 2px solid #000;
}
http.redirects:
405bourkestreet.com:
to_url: http://www.405bourkestreet.com
redirect_with_path: True
405bourkestreet.com.au:
to_url: http://www.405bourkestreet.com
redirect_with_path: True
'use strict';
var ext = require('./.gruntExt')
module.exports = function (grunt) {
// Paths and things
ext.configure({
path: {
content: 'contents',
css: 'contents/css',
scripts: 'contents/scripts'
@shadowmint
shadowmint / config.json
Last active August 29, 2015 14:03
Tagged post filter for Wintersmith
{
"locals": {
"url": "http://shadowmint.com",
"name": "Coffee & Code",
"owner": "shadowmint",
"description": "Code adventures with coffee~"
},
"plugins": [
"./plugins/paginator.coffee",
"./plugins/debug.js", // <------------
@shadowmint
shadowmint / tmp.js
Created July 18, 2014 03:33
Javascript plays
// Fake FAaaake
var src = '123121312322211112222';
var offset = 0;
function next() {
var rtn = offset < src.length ? src[offset] : null;
offset += 1;
return rtn;
}
function score(l1) {
@shadowmint
shadowmint / vec2d.rs
Created August 6, 2014 06:59
A 2d vector prototype
use std::mem::transmute;
use std::ops::Index;
struct Vec2d {
width:uint,
values:Vec<uint>
}
struct Vec2dView {
value:uint
@shadowmint
shadowmint / unsafe version
Last active August 29, 2015 14:05
hashmap
use std::collections::HashMap;
struct Tmp {
v:String
}
impl Tmp {
fn new(value:&str) -> Tmp {
return Tmp {
v:String::from_str(value)
def url(self, image, width=None, height=None):
"""Generate a scaled image url from the given values """
if width is None:
width = image.width
if height is None:
height = image.height
scales = image.restrictedTraverse('@@images')
scaled_image = scales.scale(
'image',
width=width,
src/string.rs:371:3: 379:4 note: consider using an explicit lifetime parameter as shown: fn clone(&self) -> String<'a>
src/string.rs:371 fn clone(&self) -> String<'b> {
src/string.rs:372 return String {
src/string.rs:373 len: self.len,
src/string.rs:374 bytes: match self.bytes {
src/string.rs:375 IsStatic(ref x) => IsStatic(x.as_array().clone()),
src/string.rs:376 IsView(ref x) => IsStatic(x.as_array().clone())
...
src/string.rs:371:3: 379:4 error: method not compatible with trait: expected `fn(&string::String<'a>) -> string::String<'a>` but found `fn(&string::String<'a>) -> string::String<'b>` (lifetime mismatch)
src/string.rs:371 fn clone(&self) -> String<'b> {