[I might throw this one out. Scroll down for the orif idea]
Sometimes when you're coding you end up with things like this:
| /// Problem: there is a lot of duplication in function implementations. | |
| /// The two types should have the same interface but use a different underlying type. | |
| /// | |
| /// How can I reduce the amount of duplication and avoid having to update the code in two places? | |
| /// In other languages, I would define a base class which accepts a generic type for the `SoundSource`s | |
| /// but I don't know how to solve this sort of problem in Rust. | |
| struct Sound { | |
| // Shared properties | |
| is_playing: bool, |
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Example", | |
| "type": "node", | |
| "request": "launch", | |
| "runtimeExecutable": "node", | |
| "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], |
| @-moz-document domain("stackoverflow.com") { | |
| body.newheader { | |
| padding-top: 0; | |
| } | |
| .so-header { | |
| background-color: #333; | |
| position: relative; | |
| } |
| var gulp = require('gulp'); | |
| var sourcemaps = require('gulp-sourcemaps'); | |
| var source = require('vinyl-source-stream'); | |
| var buffer = require('vinyl-buffer'); | |
| var browserify = require('browserify'); | |
| var watchify = require('watchify'); | |
| var babel = require('babelify'); | |
| function compile(watch) { | |
| var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
| #!/bin/bash | |
| ## | |
| ## A simple little shell script that will return the current | |
| ## fingerprint on the SSL certificate. It's crude but works :D | |
| ## | |
| ## Author: Bob Saska (r35krag0th) <[email protected]> | |
| openssl s_client -connect tuner.pandora.com:443 < /dev/null 2> /dev/null | \ | |
| openssl x509 -noout -fingerprint | tr -d ':' | cut -d'=' -f2 |
| if (!document.querySelectorAll) { | |
| document.querySelectorAll = function(selector) { | |
| var doc = document, | |
| head = doc.documentElement.firstChild, | |
| styleTag = doc.createElement('STYLE'); | |
| head.appendChild(styleTag); | |
| doc.__qsaels = []; | |
| styleTag.styleSheet.cssText = selector + "{x:expression(document.__qsaels.push(this))}"; | |
| window.scrollBy(0, 0); |