Skip to content

Instantly share code, notes, and snippets.

View reyaz's full-sized avatar

Reyaz Rohani reyaz

View GitHub Profile
@reyaz
reyaz / creature-types.js
Last active August 18, 2023 17:48
Scryfall Utils
// Unique creature types (https://scryfall.com/search?as=text…)
//
// Store
//
var k = 'tmp_types', ls = localStorage, n = document.querySelectorAll('.card-text-type-line'), s = new Set(ls.getItem(k)?.split(',') || []); ls.setItem(k, [...[...n].reduce((a,c) => a.add(c.innerText), s)]);
//
// Copy
@reyaz
reyaz / index.html
Created March 28, 2022 22:48
Untitled
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Untitled</title>
</head>
<body>
<div data-v-component="search"></div>
<script src="https://unpkg.com/vue@3"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
* {
box-sizing: border-box;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
* {
box-sizing: border-box;
}
@reyaz
reyaz / flattener.js
Last active March 9, 2018 05:51
Code Sample: Array Flattener
const assert = require('assert')
assert.deepEqual(flatten([[1,2,[3]],4]), [1,2,3,4])
/**
* Returns a flattened array.
* @param {array} input
* @param {array=} output
*/
function flatten (input, output = []) {
@reyaz
reyaz / premise-code-challenge.js
Created February 27, 2018 22:46
Premise Code Challenge
function addStyling(string, styles) {
const chars = string.split('');
const formatedChars = [];
const grid = {};
for (const className in styles) {
grid[className] = [];
styles[className].forEach((range) => {
for (let i = range[0]; i <= range[1]; i++) {
@reyaz
reyaz / player.js
Created October 14, 2016 20:45
Playback Health Check
'use strict';
var player = (function () {
var privateIsPlaying = false;
var privateShouldBePlaying = false;
var privatePlaybackEndTimeout;
var privatePlaybackEndTimeoutDelay = 10000;
var privatePlaybackErrorTimeout;
var privatePlaybackErrorTimeoutDelay = Math.random();
@reyaz
reyaz / index.html
Created September 9, 2016 22:38
LRpbLK
<div ng-app="app">
<div ng-controller="main">
<div ng-repeat="type in types">
<h1>{{type}} Lists</h1>
<div class="list" ng-class="{current: isCurrentList(type, $index)}" ng-repeat="list in lists | hasType:type">
<div>{{list.created_on}}</div>
<ul>
<li ng-repeat="item in list.items | filter:{'type': type} | shouldLoadItem:isLoadedList(type, $index)">{{item}}</li>
</ul>
@reyaz
reyaz / snippets.cson
Created February 23, 2016 23:09
Atom.io Snippets
'.source.js':
'console.log':
'prefix': 'yo'
'body': 'console.log("[Yo Reyaz!] $1"$2);$3'
attr=['"]?\s*(?:\w+\s+)*\b(string)\b(?:\s+\w+)*\s*['"]?