Skip to content

Instantly share code, notes, and snippets.

View sethladd's full-sized avatar

Seth Ladd sethladd

View GitHub Profile
@sethladd
sethladd / check_wordpress_blogger_links.rb
Created March 10, 2010 06:47
Migrate from Wordpress to Blogger
@sethladd
sethladd / app.dart
Created February 2, 2012 05:39
Web Audio API and Dart
#import('dart:dom', prefix:'dom');
#import('dart:html');
main() {
dom.AudioContext audioContext = new dom.AudioContext();
dom.AudioBufferSourceNode source = audioContext.createBufferSource();
dom.AudioGainNode gainNode = audioContext.createGainNode();
source.connect(gainNode, 0, 0);
@sethladd
sethladd / export_mtgen.js
Created April 17, 2022 16:24
Export MTG proxies from mtgen.net
console.log([...document.querySelectorAll('.active .card')].map(card => card.title.replace(" - Foil", "")).map(title => `1 ${title} (NEO)`).join("\n"))
@sethladd
sethladd / flutter_localized_title.dart
Last active July 29, 2021 08:05
Flutter example of a localized title
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Note: I'm not the original author, I'm sharing via Gist to make
// it easy for folks to check it out. Please email
// flutter-dev@googlegroups.com if you have questions about that.
// A simple "rough and ready" example of localizing a Flutter app.
// Spanish and English (locale language codes 'en' and 'es') are
@sethladd
sethladd / more_simple_multiple_http_server_handler.dart
Last active January 2, 2020 11:26
Registering multiple HTTP handlers for a Dart web server. Not sure if this is the best way or not.
HttpServer.bind('127.0.0.1', 8889)
.then((HttpServer server) {
var sc = new StreamController();
sc.stream.transform(new WebSocketTransformer()).listen(handleWebSocket);
server.listen((HttpRequest request) {
if (request.uri.path == '/ws') {
sc.add(request);
} else if (request.uri.path == '/foo') {
request.response.addString('foo');
@sethladd
sethladd / streams_and_event_loop.dart
Created February 8, 2013 21:38
Streams, stream controller, and event loops in Dart.
import 'dart:async';
import 'dart:math';
/*
* Findings:
* streams can be single or broadcast, but not sure why the diff.
* can check if a stream is broadcast with isBroadcast
* StreamController make it easy to use a stream and send it events
*/
@sethladd
sethladd / app.dart
Created February 12, 2014 00:35
Example of lazy loading with Dart.
import 'dart:async';
@lazy
import 'big_lib.dart' as big show soManyFunctions;
const lazy = const DeferredLibrary('big', uri: 'big.js');
void main() {
lazy.load().then((_) {
big.soManyFunctions();
{
"kind": "chromewebstore#license",
"id": "ejbknjbccnnccddiljheadjafeeagcan/https://www.google.com/accounts/o8/id?id\u003dAItOawlh_ZYIBQi-kNV-d3Rd8WIjQEBsLDh5LDQ",
"appId": "ejbknjbccnnccddiljheadjafeeagcan",
"userId": "https://www.google.com/accounts/o8/id?id\u003dAItOawlh_ZYIBQi-kNV-d3Rd8WIjQEBsLDh5LDQ",
"result": "YES",
"accessLevel": "FREE_TRIAL"
}
return new SingleChildScrollView(
child: new Container(
margin: const EdgeInsets.all(16.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
@sethladd
sethladd / Original.dart
Last active June 3, 2017 18:19 — forked from asarazan/Original.dart
Comparing Flutter to what it might look like in Kotlin, Dart.soon, and Dart.wishlist
class TutorialHome extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Scafold is a layout for the major material design widgets.
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Navigation menu',
onPressed: null,