Skip to content

Instantly share code, notes, and snippets.

View reyaz's full-sized avatar

Reyaz Rohani reyaz

View GitHub Profile
@reyaz
reyaz / gist:ad7f21dd19d043f577c2
Last active December 16, 2015 23:30
Desk.com Widget URL Builder for OpenSky.com Contact Page
/* This script passes data from OpenSky.com's main JS object to Desk.com via
* query params for a customized contact form loaded in an iframe (yuck). */
/* Hide the iframe (if it’s not already hidden) */
$(document.getElementById('desk-contact-iframe')).addClass('is-hidden');
// http://www.joezimjs.com/javascript/3-ways-to-parse-a-query-string-in-a-url/
var parseQueryString = function( queryString ) {
var params = {}, queries, temp, i, l;
attr=['"]?\s*(?:\w+\s+)*\b(string)\b(?:\s+\w+)*\s*['"]?
@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'
@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 / 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 / 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 / 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 = []) {
<!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 / 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>