Skip to content

Instantly share code, notes, and snippets.

View vinaypuppal's full-sized avatar
🤓
Working from home

vínαч puppαl vinaypuppal

🤓
Working from home
View GitHub Profile
@vinaypuppal
vinaypuppal / nested-fql-template.js
Created April 8, 2020 21:19 — forked from ptpaterson/nested-fql-manual.js
Template for building deeply nested FQL queries for FaunaDB
const baseQuery = q.Paginate(q.Match(q.Index(indexName), terms));
// or
// const baseQuery = q.Paginate(q.Collection(collectionName))
const expandedQuery = q.Map(baseQuery, (ref) =>
q.Let(
{
instance: q.Get(q.Var('ref'))
},
{
@vinaypuppal
vinaypuppal / JSON_to_URLEncoded.js
Created September 30, 2016 21:20 — forked from lastguest/JSON_to_URLEncoded.js
Convert JavaScript object to x-www-form-urlencoded format
function JSON_to_URLEncoded(element,key,list){
var list = list || [];
if(typeof(element)=='object'){
for (var idx in element)
JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list);
} else {
list.push(key+'='+encodeURIComponent(element));
}
return list.join('&');
}
@vinaypuppal
vinaypuppal / now-realias.js
Created September 6, 2016 11:38 — forked from remy/now-realias.js
Quick `now` re-alias script, if run inside the current project dir
#!/usr/bin/env node
const Now = require('now-client');
const now = Now(); // this looks like it detect the token from ~/.now.json or the env automatically
const pkg = require(process.cwd() + '/package.json');
now.getDeployments().then(res => {
const [latest, prev, ...rest] = res.filter(_ => _.name === pkg.name).sort((a, b) => b.created - a.created);
console.log(`getting alias for ${prev.uid} (${prev.url})`);
return now.getAliases(prev.uid).then(res => {
/* Made by ciara.io for Meteor Academy */
body {
color: #333;
font-family: sans-serif;
font-size: 115%;
line-height: 24px;
}
footer {