Skip to content

Instantly share code, notes, and snippets.

<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;
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'
@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 {
@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;
var Summary1 = React.createClass({
render: function(() {
var cards = this.props.cards
return (
<div>
<Notification />
<div>
cards.map(function(card, i) {
return <Card key={'key' + i} data={card}>
@OlavHN
OlavHN / Header.jsx
Last active August 29, 2015 14:11
Drag to animation
'use strict';
var React = require('react');
var RCSS = require('rcss');
var tweenState = require('react-tween-state');
var DragMixin = require('./mixins/drag-mixin');
var headerStyle = RCSS.registerClass({
position: 'relative',
width: '100%',
function gameoflife(matrix) {
var population = [];
for (var i = 0; i < matrix.length; i++) {
population[i] = [];
for (var j = 0; j < matrix[0].length; j++)
population[i][j] = 0;
}
matrix.forEach(function(row, i) {
row.forEach(function(col, j) {
// known mcc/mnc values for our sim card (this is Telenor Norway)
var mcc = 242;
var mnc = 01;
// First get the sim card number (API supports multi sim phones)
var simNum = Array.slice(window.navigator.mozMobileConnections)
.reduce(function(current, connection, i) {
if (connection && connection.data && connection.data.network) {
// For ONCE we're actually using type coercion as it's meant here!
if (connection.data.network.mcc == mcc &&
@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;
{
"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": {