This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo: foo.c foo.h bar.c bar.h | |
| gcc bar.c foo.c -o foo -lm | |
| clean: | |
| rm foo foo.o bar.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>select-sk demo</title> | |
| <meta charset="utf-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=egde,chrome=1"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <script type="text/javascript" charset="utf-8"> | |
| // This bit of script loads the custom elements v1 polyfill, but only if required. | |
| if (!window.customElements) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.customElements.define('subreddit-van', class extends HTMLElement { | |
| // Only get callbacks when our 'name' attribute changes. | |
| static get observedAttributes() { return ['name']; } | |
| // Called when our 'name' attribute changes. | |
| attributeChangedCallback(attr, oldValue, newValue) { | |
| if (newValue === '') { | |
| return | |
| } | |
| fetch(`https://www.reddit.com/r/${ newValue }/top.json?limit=5`).then(resp => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spinner-bw { | |
| display: none; | |
| border-radius: 50%; | |
| width: 2em; | |
| height: 2em; | |
| border: 0.4em solid #A6CEE3; | |
| border-left: 0.4em solid #1F78B4; | |
| animation: spinner-bw-spin 1.5s infinite linear; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <div id=target></div> | |
| <script type="module" charset="utf-8"> | |
| import { html, render } from './lit-html.js'; | |
| const renderForm = (entity) => { | |
| const e = []; | |
| Object.keys(entity).forEach((attr) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.StateTools = this.StateTools || {}; | |
| (function(sr) { | |
| "use strict"; | |
| // A Promise that resolves when DOMContentLoaded has fired. | |
| sr.DomReady = new Promise(function(resolve, reject) { | |
| if (document.readyState != 'loading') { | |
| // If readyState is already past loading then | |
| // DOMContentLoaded has already fired, so just resolve. | |
| resolve(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Binder makes it easy to setup bindings between data stored in a Redux | |
| // store and HTML elements. | |
| class Binder { | |
| // store - A Redux store. | |
| // dispatch - A function called to update the state in store. | |
| // ele - The root element where all element searches begin from, i.e. | |
| // querySelectorAll is run on this element. Defaults to document. | |
| constructor(store, dispatch, ele = document) { | |
| this.to = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let dup = (o) => JSON.parse(JSON.stringify(o)); | |
| let canvas = document.querySelector("canvas"), | |
| ctx = canvas.getContext("2d"), | |
| width = canvas.width, | |
| height = canvas.height; | |
| let rules = { | |
| "X": "F-[[X]+X]+F[+FX]-X", | |
| "F": "FF", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <label for=length>Length:</label> | |
| <input type=range name=length id=length min=1 max=10 /> | |
| <span style="padding: 0 10px;" id=lengthDisplay></span> | |
| <br> | |
| <label for=angle>Angle:</label> | |
| <input type=range name=angle id=angle min=0.01 max=1 step=0.01 /> | |
| <span style="padding: 0 10px;" id=angleDisplay></span> | |
| <br> | |
| <canvas width=600 height=600></canvas> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| var dup = (o) => JSON.parse(JSON.stringify(o)); | |
| var $ = (id) => document.getElementById(id); | |
| var canvas = document.querySelector("canvas"), | |
| ctx = canvas.getContext("2d"), | |
| width = canvas.width, | |
| height = canvas.height; | |
| var rules = { |