Skip to content

Instantly share code, notes, and snippets.

@sethlopezme
sethlopezme / full-match.js
Last active February 13, 2024 07:35
Regex for matching any hex, rgb(a), or hsl(a) value. Assumes that you've lowercased the string and removed spaces.
/^(#?([a-f\d]{3,4}|[a-f\d]{6}|[a-f\d]{8})|rgb\((0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d)\)|rgba\((0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),(0|255|25[0-4]|2[0-4]\d|1\d\d|0?\d?\d),(0|0?\.\d|1(\.0)?)\)|hsl\((0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),(0|100|\d{1,2})%,(0|100|\d{1,2})%\)|hsla\((0|360|35\d|3[0-4]\d|[12]\d\d|0?\d?\d),(0|100|\d{1,2})%,(0|100|\d{1,2})%,(0?\.\d|1(\.0)?)\))$/
@sethlopezme
sethlopezme / keymap.cson
Last active October 8, 2020 00:58
My Atom keymap for focusing and splitting panes, and moving pane items. Based on the shortcuts from the Origami (https://packagecontrol.io/packages/Origami) package for Sublime Text.
'.platform-darwin':
# focus pane
'cmd-k left': 'window:focus-pane-on-left'
'cmd-k right': 'window:focus-pane-on-right'
'cmd-k up': 'window:focus-pane-above'
'cmd-k down': 'window:focus-pane-below'
# split pane
'cmd-k cmd-left': 'pane:split-left'
'cmd-k cmd-right': 'pane:split-right'
'cmd-k cmd-up': 'pane:split-up'
@sethlopezme
sethlopezme / package.json
Last active April 12, 2018 15:21
Complete files for my article, Testing Hapi.js APIs. https://sethlopez.me/article/testing-hapi-js-apis
{
"name": "testing-hapi-js-apis",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"test": "ava --verbose test.js"
},
"dependencies": {
"ava": "^0.16.0",
"hapi": "^15.1.1"
@sethlopezme
sethlopezme / screencasting.md
Last active November 5, 2017 03:31
These are my notes and tips on screencasting.

Screencasting

These are my notes and tips on screencasting.

Tools

Mac

#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Scope {
Any,
Account,
Edit,
// ...
}
impl fmt::Display for Scope {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
extern crate reqwest;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_urlencoded;
use std::collections::HashSet;
use std::fmt;
use serde::Serializer;
@sethlopezme
sethlopezme / common_mod.rs
Last active December 28, 2016 02:44
config/tests/common/mod.rs
#![feature(plugin)]
#![plugin(rocket_codegen)]
// use rocket::config;
use rocket::http::Method;
use rocket::testing::MockRequest;
extern crate config as lib;
#[test]

Keybase proof

I hereby claim:

  • I am sethlopezme on github.
  • I am sethlopez (https://keybase.io/sethlopez) on keybase.
  • I have a public key ASARj60WtsGiHtRNL8Xw4gUxU9T1zqojCzDawBTRfG51PAo

To claim this, I am signing this object:

{
"dependencies": {
"jshint": "latest",
"uglifyjs": "latest",
"watch": "latest"
},
"config": {
"github_url": "https://api.github.com/repos/MarkBiesheuvel/markbiesheuvel.nl/commits?page=1&per_page=10",
"maps_url": "https://maps.googleapis.com/maps/api/staticmap?size=640x200&zoom=7&markers=color%3Ablue%7Clabel%3AH%7C51.469941%2C5.472258&markers=color%3Ayellow%7Clabel%3AW%7C51.574344%2C5.13781",
},
@sethlopezme
sethlopezme / README.md
Last active August 29, 2015 14:26 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation