Skip to content

Instantly share code, notes, and snippets.

View starsinmypockets's full-sized avatar

Paul Walker starsinmypockets

View GitHub Profile
@starsinmypockets
starsinmypockets / regex.md
Last active March 20, 2019 14:12
Useful regex

Some dumb regex for VIM

Remove commas from numbers

%s/\(\d\+\),\(\d\+\)/\1\2/g

Converts 123111 - Name of Book - Book Author to JSON array

%s/^\(\d\+\).–.\(.*\).–.\(.*\)/[\1, "\2", "\3"],/g
/**
* Our scheduling algorithm only shows optimistic availble gaps based on the driver's current schedule, and the current time
* As time goes on and the schedule changes, we update gaps / availability to reflect new facts, but we don't need logic for that,
* since those are inputs
**/
// Schedule:
[
// a scheduled trip
[
{ start: Date, end: Date }, // earliest possible start time - max(apptStart, now)
title: $:/config/tiddlyweb/host
$protocol$//$host$/tw/
@starsinmypockets
starsinmypockets / fa-social-nav.html
Created October 9, 2017 03:16
Social media nav with font-awesome icons
<div id="social-nav">
<ul>
<li class="fa fa-github"><a href="#" target="blank"></a></li>
<li class="fa fa-stack-overflow"><a href="#" target="blank"></a></li>
<li class="fa fa-linkedin"><a href="#" target="blank"></a></li>
<li class="fa fa-twitter"><a href="#" target="blank"></a></li>
</ul>
</div>
module Main exposing (..)
import Debug exposing (log)
findMin list =
List.map toString list
|> List.sort
|> log "ll"
|> List.foldr (++) ""
|> String.toInt
module Main exposing (..)
import Html as H exposing (h1, div, ul, span)
import Html.Attributes exposing (..)
import Debug exposing (log)
import Array
-- CONSTANTS
module DPXMLtoJSON exposing (..)
import Html exposing (text)
import Xml exposing (Value)
import Xml.Encode exposing (null)
import Xml.Decode exposing (decode)
import Xml.Query exposing (tags)
import Json.Encode exposing (encode)
import Debug exposing (log)
@starsinmypockets
starsinmypockets / melt.js
Last active July 19, 2017 14:58
js-melt
// alphabet returns alphabet as array of strings, or a subset
const alphabet = function (start, length) => // implement
// make two grids of letters
const grid1 = _.range(0,10,1).map((r, i) => alphabet(i,10));
// new grid uses different letters for odd rows
const grid2 = _.range(0,10,1).map((r, i) => (i % 0) ? : [] : alphabet(i+1, 10))
// melt merges grid1 and grid2, replacing grid1 values with grid2 values, if they exist
// Example Data
var CARS = [{
name: 'Ferrari FF',
horsepower: 660,
dollar_value: 700000,
in_stock: true,
}, {
name: 'Spyker C12 Zagato',
horsepower: 650,
dollar_value: 648000,
// Exercise 1
//==============
// Refactor to remove all arguments by partially applying the function.
const words = function(str) {
return _.split(' ', str);
};
const bibleIntro = function(str) {
return words("In the beginiing " + str);