Skip to content

Instantly share code, notes, and snippets.

@jasonseminara
jasonseminara / bst.coffee
Last active August 29, 2015 14:01
first coffeescript
bst=(r)->
_root = r
compare=(a,b)->
return switch
when a is b then 0
when a < b then -1
when a > b then 1
root:()->_root
<cffunction
name="QueryToCSV"
access="public"
returntype="string"
output="false"
hint="I take a query and convert it to a comma separated value string.">
<!--- Define arguments. --->
<cfargument
name="Query"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@jasonseminara
jasonseminara / colorList.js
Created January 15, 2019 17:01
color list
const colors = 'red orange red yellow green blue yellow indigo violet red indigo orange green blue';
const colors = 'red orange red yellow green blue yellow indigo violet red indigo orange green blue';
const colorsMapped = colors.split(' ').reduce((set, item, i) => {
if (item in set) return set;
// if the item isn't in the set, put it in and record its position
// don't do any mutations!
return {
...set,
[item]: i,
/**
* one-line solution with sets!
*/
const oneliner = [...new Set(colors.split(' '))].join(' ');
console.log(oneliner);
/**
* WHOAH! let's break that down!
*/
### Keybase proof
I hereby claim:
* I am jasonseminara on github.
* I am jasonseminara (https://keybase.io/jasonseminara) on keybase.
* I have a public key ASBbXJuctRaJZcwDrmK_S1uZfaw7bXhH3TMutfeL_h8hDwo
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jasonseminara on github.
  • I am jasonseminara (https://keybase.io/jasonseminara) on keybase.
  • I have a public key ASArAAJZqOZT7hFBOarI1dUNrD0g3FIvAOR0u-RudC7RiQo

To claim this, I am signing this object: