Skip to content

Instantly share code, notes, and snippets.

@pe3
pe3 / index.html
Created February 1, 2014 17:20
Recycle SVG elements with defs
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Diagram</title>
</head>
<body>
<div>
<svg width="200" height="100">
<defs>
@pe3
pe3 / React-0.13-ES2015-SUIT-CSS.md
Last active August 29, 2015 14:15
React 0.13 ES2015 SUIT CSS

to run: webpack-dev-server

suit-loader is deprecated.

should probably use something like rework-webpack-loader but i dont understand webpack or rework well enough.

@pe3
pe3 / fetchInComponent.js
Last active October 22, 2015 23:15
REST call in componentWillMount
import React from 'react'
import ReactDOM from 'react-dom'
import fetch from 'isomorphic-fetch'
const App = () => (
<div>
<RepositoryList id="pe3"/>
</div>
)
@pe3
pe3 / index.html
Last active December 19, 2015 06:29
Show OpenStreetMap with Leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Test</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<style type="text/css">
@pe3
pe3 / Gruntfile.coffee
Created July 8, 2013 11:07
Compile Jade to HTML with minimal Grunt
module.exports = (grunt) ->
grunt.initConfig
jade:
compile:
options:
pretty: true
data: { pageTitle: 'Otsikko otsikko', youAreUsingJade: '1' }
files: [
src: './example.jade'
dest: './example.html'
@pe3
pe3 / Gruntfile.coffee
Created July 8, 2013 11:58
Compile YAML to JSON with minimal Grunt
module.exports = (grunt) ->
grunt.initConfig
yaml:
render: #miksi tähän voi taas laittaa mitä vaan?
files: [
src: './example.yaml'
dest: './example.json'
]
grunt.loadNpmTasks 'grunt-yaml'
@pe3
pe3 / Gruntfile.coffee
Last active December 19, 2015 11:29
Downloading a HTML file with minimal Grunt
module.exports = (grunt) ->
grunt.initConfig
curl:
long:
src: 'http://www.hankintailmoitukset.fi/fi/?all=1'
dest: './scrape-file.html'
grunt.loadNpmTasks 'grunt-curl'
grunt.registerTask 'default', 'This is the default task', 'curl'
@pe3
pe3 / Gruntfile.coffee
Last active December 19, 2015 11:38
Compile Handlebars to HTML with minimal Grunt
module.exports = (grunt) ->
grunt.initConfig
staticHandlebars:
options:
partials: ""
helpers: ""
simpleTarget:
# Target-specific file lists and/or options go here.
@pe3
pe3 / style.css
Created July 10, 2013 09:46
Show all CSS borders
* {
border: 1px dashed #0000ff;
}
@pe3
pe3 / hello.cpp
Created July 14, 2013 22:00
Compiling C++ Hello world on OSX
/* compile with: g++ hello.cpp -o hello */
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!\n";
return 0;
}