An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
license: gpl-3.0 | |
redirect: https://observablehq.com/@d3/diverging-bar-chart |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
<html> | |
<body> | |
<video id="v" width="300" height="300"></video> | |
<input id="b" type="button" disabled="true" value="Take Picture"></input> | |
<canvas id="c" style="display:none;" width="300" height="300"></canvas> | |
</body> | |
<script> | |
navigator.getUserMedia({video: true}, function(stream) { | |
var video = document.getElementById("v"); | |
var canvas = document.getElementById("c"); |
Some improvements have been made for parser and lexer grammars in Jison 0.3 (demonstrated in the FlooP/BlooP example below.)
For lexers:
%options flex case-insensitive
flex
: the rule with the longest match is used, and no word boundary patterns are addedcase-insensitive
: all patterns are case insensitive# | |
# Initialize the stuff | |
# | |
# We build the status bar item menu | |
def setupMenu | |
menu = NSMenu.new | |
menu.initWithTitle 'FooApp' | |
mi = NSMenuItem.new | |
mi.title = 'Hellow from MacRuby!' | |
mi.action = 'sayHello:' |
# 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 |
var http = require('http') | |
, fs = require('fs') | |
, PORT = process.argv[2] || 8080 | |
, HOST = process.argv[3] || '127.0.0.1'; | |
http.createServer(function (req, res) { | |
if (req.url == '/events') { | |
res.writeHead(200, { 'Content-Type' : 'text/event-stream' | |
, 'Cache-Control' : 'no-cache' |
var socket = null; | |
function bootstrap() { | |
// 適当な図形を描画 | |
var c = document.getElementById('mycanvas'); | |
var ctx = c.getContext('2d'); | |
ctx.globalalpha = 0.3; | |
for(var i=0; i<1000; i++) { | |
ctx.beginPath(); |
require 'amqp' | |
module HiringThingEM | |
def self.start | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
# for passenger, we need to avoid orphaned threads | |
if forked && EM.reactor_running? | |
EM.stop | |
end | |
Thread.new { |