Skip to content

Instantly share code, notes, and snippets.

View ameyms's full-sized avatar

Amey Sakhadeo ameyms

View GitHub Profile
@ameyms
ameyms / GQL Examples.md
Last active April 24, 2023 18:50
GQL Examples

car_owners_summary is a query that should return a summarization of car owner information (with time granularity as an optional argument)

The part I was curious about was how you feel about "row count increasing by adding one additional field in the query". Essentially, when fields are added to the query, it returns a cross product between two tables.

Example 1

Query

{
@ameyms
ameyms / load-db.js
Last active September 17, 2019 22:17
const sep = /[\n\r\.]+/ugs;
const genid = (i, suffix) => `false_13104670562-1546901958@g.us_3A188224CA720829${i.toString(16)}${suffix}`;
let counter = 0;
const loadDb = (text) => {
const lines = text.split(sep).filter(line => !!line && !sep.test(line.trim()) && !!line.trim()).map(line => line.trim());
counter++;
new Dexie('model-storage').open().then(db => {
@ameyms
ameyms / dabblet.css
Created November 19, 2017 20:41
Ratings Stars
/*
Ratings Stars
(with as little code as possible)
*/
.rating {
unicode-bidi: bidi-override;
direction: rtl;
text-align: center;
}
.rating > span {
@ameyms
ameyms / cloud.js
Last active July 25, 2017 17:36 — forked from blockspring/cloud.js
D3 Wordcloud
// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
(function() {
function cloud() {
var size = [256, 256],
text = cloudText,
font = cloudFont,
fontSize = cloudFontSize,
fontStyle = cloudFontNormal,
fontWeight = cloudFontNormal,
@ameyms
ameyms / apply_plugin.js
Created January 26, 2015 23:03
A directive and provider pair to apply arbitrary JQuery plugins to elements
angular.module( 'ameyms.jqplugin' ).
directive( 'applyPlugin', [ 'jqueryPlugins', function ( jqPlugins ) {
var postLinkFn;
postLinkFn = function ( scope, elem, attrs ) {
var currPlugin = attrs.applyPlugin,
opts = jqueryPlugins.getOptionsFor( currPlugin );
// Apply plugin
$( elem )[ currPlugin ]( opts );
@ameyms
ameyms / final_goal.md
Created August 15, 2014 15:30
Lost in $translate
@ameyms
ameyms / dom_manip_ctrl.js
Created August 15, 2014 14:56
Angular Blasphemy
angular.module('myApp').controller( function ( $scope ) {
var foo = $('button.foo'),
bar = $('input[data-role="bar"]'),
baz = $('div.status'),
flag = true;
foo.click( function () {
if ( flag ) {
bar.hide();
baz.addClass( 'done' );
}
@ameyms
ameyms / README.md
Last active September 15, 2021 11:28
D3 Gauge - Part Deux

Yet another simple gauge chart using d3 Inspired by Jake Trent's Codepen snippet

To move the pointer needle, type in following code in you javascript console

needle.moveTo(.25)
@ameyms
ameyms / README.md
Created February 22, 2014 08:41
D3 Gauge

A simple gauge chart using d3 Inspired by Jake Trent's Codepen snippet

To move the pointer needle, type in following code in you javascript console

needle.moveTo(.25)
@ameyms
ameyms / README.md
Last active August 29, 2015 13:56
Line Chart using d3.svg.brush

A D3 line chart demonstrating d3.svg.brush() for zooming capabilities à la Google Finance