Skip to content

Instantly share code, notes, and snippets.

@OlavHN
OlavHN / gist:f11798cf233f7661b898
Created October 28, 2014 10:54
polymer hello-world
<polymer-element name="post-card">
<template>
<style>
:host {
display: block;
position: relative;
background-color: white;
padding: 20px;
width: 100%;
font-size: 1.2rem;
@OlavHN
OlavHN / designer.html
Created October 17, 2014 14:21
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
var crypto = require('crypto');
var express = require('express');
var app = express();
// TODO: derive keys using pbkdf2 and some time step in the salt to get TTLs.
var db = {};
var sever_secret = '123456';
var key_salt = '123456'
<body></body>
<script>
var container = document.createElement('div');
for(var i = 0; i<5;i++) {
var elem = document.createElement('div')
elem.textContent = "I am " + i;
container.appendChild(elem);
}
container.addEventListener('click', function(e) {
var clicked = e.target;
@OlavHN
OlavHN / gist:7427620
Created November 12, 2013 08:45
Type checking in javascript!
function type_checker() {
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
function getParamNames(func) {
var fnStr = func.toString().replace(STRIP_COMMENTS, '');
var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(/([^\s,]+)/g);
if(result === null)
result = [];
return result;
}
return function(types, func) {
From 0d54f904cebce9cad031af8e5dd6b040d3f314f3 Mon Sep 17 00:00:00 2001
From: Olav Nymoen <olav@comoyo.com>
Date: Fri, 23 Aug 2013 11:40:57 +0200
Subject: [PATCH] testing datastores
---
apps/test/index.html | 2 ++
apps/test/manifest.webapp | 26 ++++++++++++++++++++++++++
apps/test/source.js | 7 +++++++
3 files changed, 35 insertions(+)
{
"name": "testee",
"description": "testing app",
"type": "certified",
"launch_path": "/index.html",
"developer": {
"name": "The Gaia Team",
"url": "https://github.com/mozilla-b2g/gaia"
},
"datastores-owned": {
@OlavHN
OlavHN / keyboard.css
Created January 9, 2013 15:07
Files: apps/keyboard/style/keyboard.css apps/keyboard/js/render.js 1. Open Contacts 2. Click Mobile -> Phone 3. Hold down button with alt key I expected it to be a highlighted alternative, but it turns out to render the key above the highlighting or something similar.
/* Media definitions */
@media screen and (max--moz-device-pixel-ratio: 1.5) {
html {
font-size: 15px;
}
}
@font-face {
font-family: 'Keyboard Symbols';
font-weight: 600;