Skip to content

Instantly share code, notes, and snippets.

@kristian76
kristian76 / untitled.html
Created April 5, 2018 11:55
Populate drop down
<html>
<form>
<select id="parent">
<option value="set1">Set opt1</option>
<option value="set2">Set opt2</option>
</select>
<select id="child">
</select>
</form>
<script>
@kristian76
kristian76 / index.js
Created October 2, 2017 06:59
React JS app for search dictionary feature
/**
*
*
*/
import { render } from 'react-dom';
import React from 'react';
class SearchDictionaryFieldsComponent extends React.Component {
constructor(props) {
super(props);
@kristian76
kristian76 / ProductSample.elm
Last active June 7, 2017 12:11
Display list of products using elm
module ProductSample exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Http
import Json.Decode as Decode
import String
@kristian76
kristian76 / danish.json
Last active March 10, 2017 09:34
Javascript L10N idea, how to handle translations in Javascript and being able to serve the translations in a simple structure
/**
* Structure of the translations is a simple
* key value storage
*/
var L10N = {
"hello_kitty": "hej killing"
};
@kristian76
kristian76 / index.js
Created January 30, 2017 13:58
React material UI planning board
/**
* index.js
*/
"use strict";
// Require app specific CSS
require('./app.css');
import React from 'react';
import ReactDOM from 'react-dom';
@kristian76
kristian76 / markup.html
Last active November 25, 2016 16:44
AB split testing in JS
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>title</title>
</head>
<body>
<script>
var AB = {
@kristian76
kristian76 / index.js
Last active November 22, 2016 17:16
task board made with rect
/**
* index.js
*/
"use strict";
// Require app specific CSS
require('./app.css');
import React from 'react';
import ReactDOM from 'react-dom';
/*
* JavaScript Pretty Date
* Copyright (c) 2011 John Resig (ejohn.org)
* Licensed under the MIT and GPL licenses.
* prettyDate("2008-01-28T20:24:17Z") // => "2 hours ago"
* prettyDate("2008-01-27T22:24:17Z") // => "Yesterday"
* prettyDate("2008-01-26T22:24:17Z") // => "2 days ago"
* prettyDate("2008-01-14T22:24:17Z") // => "2 weeks ago"
* prettyDate("2007-12-15T22:24:17Z") // => undefined
@kristian76
kristian76 / main.js
Created August 27, 2016 09:26
React and Gun showing list of Github issues
/**
* Main.js
*/
'use strict';
import React from 'react'
import { render } from 'react-dom'
const gun = Gun(location.origin +'/gun');
const GUN_PATH = 'repo_42';
@kristian76
kristian76 / http.js
Last active August 19, 2016 05:50
Gun and webpack
var express = require('express'),
app = express();
var Gun = require('gun');
var gun = Gun({
file: 'data.json'
});
gun.wsp(app);
app.use(express.static(__dirname)).listen(9000);