Skip to content

Instantly share code, notes, and snippets.

@psbolden
psbolden / 0_reuse_code.js
Created June 30, 2016 15:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
{
"application_id": "YOUR_APP_ID",
"src": "https://s3.amazonaws.com/img.blitline/filters/boys.jpeg",
"functions": [
{
"name": "composite",
"params": {
"src": "https://s3.amazonaws.com/img.blitline/grad_vignette_index.png"
},
"functions": [
@psbolden
psbolden / sample_svg.json
Created October 26, 2016 22:25 — forked from blitline-dev/sample_svg.json
sample_svg.json
{
"application_id":"YOUR_APP_ID",
"src":"https://s3.amazonaws.com/dev.blitline/sample.svg",
"functions":[
{
"name":"resize_to_fit",
"params":{
"width" : 400
},
"save":{
@psbolden
psbolden / index.html
Last active January 21, 2017 19:44 — forked from anonymous/index.html
Vue 2 Router Example - source https://jsbin.com/bikadol/7
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="app">
<router-view class="view"></router-view>
@psbolden
psbolden / gist:f14a31a1035bcb52fb7f7249ed31216c
Created February 10, 2017 18:56
invoking a lambda function from the browser - example
source: http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/browser-invoke-lambda-function-full.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Emoji Slots</title>
<link href="emojislots.css" rel="stylesheet" type="text/css">
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.20.min.js"></script>
@psbolden
psbolden / gist:498bf976404279a53deed9603ee3cba8
Created February 14, 2017 21:51
fabric.js ungrouping and grouping items
source: http://stackoverflow.com/questions/30904999/grouping-and-ungrouping-fabric-js-objects
var canvas = new fabric.Canvas('paper',{
isDrawingMode: true
});
$("#select").click(function(){
canvas.isDrawingMode = false;
});
$("#draw").click(function(){
@psbolden
psbolden / gist:e1a2dcd11d1e15843efe0521b057e76e
Created February 16, 2017 16:41
fabric.js change text font
Source: http://stackoverflow.com/questions/32395416/fabric-canvas-font-style-change-after-added
HTML
_____
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.5.0/fabric.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label>Select Font:</label>
<select name="FontStyleNumber" id="FontStyleNumber">
<option value="Times New Roman">Times New Roman</option>
@psbolden
psbolden / gist:49fa36c71fe72fff7ef7a7bb61c0d1c9
Created February 16, 2017 16:51
Fabric JS to SVG, PNG, Object
Source:
HTML
_____
<canvas id="c" width="300" height="300"></canvas>
CSS
_____
@psbolden
psbolden / gist:f331f2921ce0c751586b8f1ac93faaf0
Created February 16, 2017 16:56
fabric.js make object(s) unselectable
Source: http://stackoverflow.com/questions/33831088/fabric-canvas-make-my-1st-object-always-unselectable?rq=1
//lowest object unselectable
var objectx = canvas.getObjects();
objectx[0].selectable = false;
//highest object unselectable
var objectx = canvas.getObjects();
objectx[objectx.length - 1].selectable = false;
@psbolden
psbolden / gist:d27c0ac9b6cba6821b35e2ea1eecdee0
Created February 16, 2017 16:58
fabric.js delete selected object
Source: http://jsfiddle.net/beewayne/z0qn35Lo/
HTMl
____
<canvas id="paper" width="400" height="400" style="border:1px solid #ccc"></canvas>
<button id="select">Selection mode</button>
<button id="draw">Drawing mode</button>
<button id="delete">Delete selected object(s)</button>