(function($) | |
{ | |
$.fn.hasClassRegEx = function(regex) | |
{ | |
var classes = $(this).attr('class'); | |
if(!classes || !regex){ return false; } | |
classes = classes.split(' '); | |
var len = classes.length; |
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)); |
'use strict'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
app.use(express.static('public')); | |
app.get('/', function(req, res) { | |
res.sendfile('./public/index.html'); |
To answer this StackOverflow question I wrote this — a small solution based on a never-rendered <canvas>
element. It fills a 1-pixel canvas with the provided fill-style, and then reads the RGBA values of that pixel. It will work with any CSS color -- name, rgba(), hex, or even something more exotic like a gradient or pattern. Invalid colors are always returned as transparent black. Transparent colors are treated as painted on a newly-cleared canvas.
It's been tested in modern-ish versions of IE, Chrome, Safari, and Firefox. The API is:
color_convert.to_hex(color) # Converts color to a hex-based RGB triple; to_hex('red') returns '#ff0000'
color_convert.to_rgba(color) # Converts color to an rgba() string; to_rgba('red') returns 'rgba(255,0,0,1)'
These rules are adopted from the AngularJS commit conventions.
node.js, selenium grid, xvfb, and webdriver.io |
You can download whole courses from an array of tutorial sites with the CLI tool youtube-dl
. In the example further down I'm using my Pluralsight account to get videos from a course at their site. Here is a list of all supported sites that you can download from with this tool
The flags you have to supply may vary depending on which site you make a request to.
You can get a free 3 month trial to Pluralsight by signing up for free to Visual Studio Dev Essentials