Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# coding: utf-8 | |
require 'sinatra' | |
set server: 'thin', connections: [] | |
get '/' do | |
halt erb(:login) unless params[:user] | |
erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
end | |
get '/stream', provides: 'text/event-stream' do |
#!/usr/lib/env ruby | |
# Acquires a shared lock on a SQLite database file and copies it to a backup | |
# usage: backup-db.rb DBFILE.db BACKUPFILE.db | |
# author: William Benton (willb@redhat.com) | |
# Public domain. | |
require 'sqlite3' | |
require 'fileutils' |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/* | |
* Author: Felipe Herranz (felhr85@gmail.com) | |
* Contributors:Francesco Verheye (verheye.francesco@gmail.com) | |
* Israel Dominguez (dominguez.israel@gmail.com) | |
*/ | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
import android.os.Handler; |
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:
evancz Mar 23, 2017 00:43
Just so folks are aware, one of the hard things about having ports just be a Task is the following. Right now, a Task is guaranteed to terminate with an error or a result.
The only way it could be otherwise is if you have something of type Task Never Never
Now, if you are calling out to random JS that is written by anyone, that guarantee goes away.
You have to call some callback to give the value back to Elm, but what if that is never called?
Maybe there's an error, maybe there is a weird code path.
Now Elm code can "leak" tasks that never get completed because of problems in JS code.
One way to protect against this is to have timeouts, such that there is some guaranteed end.
My point here is just that it is more complicated than "what if it was a task?" and then everything would be nice.
<html> | |
<head> | |
<title>CSS Transform Scale element to fit its parent</title> | |
<script src="scale2fit.js"></script> | |
<link rel="stylesheet" href="style.css"/> | |
<script> | |
(function(window) { | |
function main() { | |
const margin = 10; | |
requestAnimationFrame(function fitToParentOnResize() { |
You'll need to include two pollyfils before you include a code with your custom elements:
• webcomponents/webcomponentsjs/custom-elements-es5-adapter.js - this is for new browsers in order to understand ES5 syntax
• webcomponents/custom-elements/custom-elements.min.js - this is for old browsers without customElements
support
You can add them to your index.html
file in the following way:
<div id="custom-elements-adapter">
I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.
But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.
Svelte is a language.
Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?
A few projects that have answered this question:
#lang racket | |
;; this is a stand alone simple version of the closure conversion part of the hoist pass from the tarot compiler | |
;; see https://rain-1.github.io/scheme for more. | |
(require data/queue) | |
;; closure conversion for lambda calculus | |
;; | |
;; the input language is: |