Skip to content

Instantly share code, notes, and snippets.

const zoomScale = [ // [ radius, min points ]
[0, 10],
[0.9, 10], // 1
[0.7, 10], // 2
[0.6, 10], // 3
[0.5, 10], // 4
[0.4, 9], // 5
[0.3, 8], // 6
[0.13, 3], // 7
[0.09, 3], // 8
const dummyData = [
{
name: 'Hot Pot',
images: [
'http://lorempixel.com/400/400/food/1/'
]
},
{
name: 'Hot Pot 2',
images: [
@psaia
psaia / trump.json
Created May 19, 2017 19:29
english2trump
{
"nouns": [
"Proclamation",
"Getting",
"ready",
"trip",
"Will",
"American",
"I",
"President",
@psaia
psaia / Pagination.js
Last active April 25, 2017 14:17
Example of a dynamic handler for relay/graphql cursor based pagination. This is ideal for when you have multiple paginations happening in one view. Bootstrap's pagination component is being used, but it could be any.
// An example of the configured Pagination component.
// I've injected the total in the connection on the server side.
<Pagination
bsSize="small"
items={Math.ceil(total / PAGE_COUNT)}
activePage={currentPage}
onSelect={this.onPageChange('mangosCurrentPage', 'mango', edges)}
/>
#!/usr/bin/env node
/**
* Process the client side application using babelify and browserify.
*/
if (!process.env.CLIENT_PATH || !process.env.SERVER_PATH) {
throw 'CLIENT_PATH and SERVER_PATH is required.'
}
@psaia
psaia / vintage.html
Created December 26, 2015 02:35
Ace's site.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body,html { margin: 0; padding: 0; }
mongoose = require 'mongoose'
helpers = require '../libs/helpers'
events = require "../libs/events"
config = require "../config"
async = require "async"
types =
STATUS: "status"
INTRODUCTION: "introduction"
NOTIFICATION: "notification"
#= require underscore
#= require typewriter
$ ->
# Homepage typewriter effect.
typeWriterElement = document.getElementById "looking-for-prompt"
if typeWriterElement
counter = 0
desires = _.shuffle [
"Anyone like craft brews?",
mongoose = require 'mongoose'
helpers = require '../libs/helpers'
config = require "../config"
gm = require "gm"
path = require "path"
os = require "os"
crypto = require "crypto"
fs = require "fs"
request = require "request"
function convert(path) {
var arr = [];
var len = path.getTotalLength();
var p;
for (var i = 0; i < len; i++) {
p = path.getPointAtLength(i);
arr.push([parseFloat(p.x), parseFloat(p.y)]);
}