This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var previousDraggedPosition = null, | |
selected = null; | |
// snap to grid is simply rounding to the nearest resolution of the square | |
function snapToGrid(p, r) { | |
return Math.round(p / r) * r; | |
} | |
// we'll use a resolution of 50 here | |
var cubeResolution = 50; | |
// randomly generate points, but make sure they snap to grid | |
var points = d3.range(10).map(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.axis path { | |
display: none; | |
} | |
.axis line { | |
stroke-opacity: 0.3; | |
shape-rendering: crispEdges; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save the current zoom in this object | |
// this is useful for redraws later on | |
var currentTransform = null; | |
// add a subview with a group tag - we'll add objects to this later | |
var view = svg.append("g") | |
.attr("class", "view"); | |
// you would execute this on any draw action to adjust zoom | |
if (currentTransform) view.attr('transform', currentTransform); | |
// this is d3's main zoom plugin - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.axis path { | |
display: none; | |
} | |
.axis line { | |
stroke-opacity: 0.3; | |
shape-rendering: crispEdges; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require('webpack'); | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
var helpers = require('./helpers'); | |
module.exports = { | |
entry: { // in this case we have three entry points in order to import three separate files for our build | |
'polyfills': './src/polyfills.ts', | |
'vendor': './src/vendor.ts', | |
'app': './src/main.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'typhoeus' | |
class Identity < ActiveRecord::Base | |
belongs_to :user | |
def refresh_token_if_expired(domain) | |
if token_expired? | |
client_id_key = self.provider.upcase + '_CLIENT_ID' | |
client_secret_key = self.provider.upcase + '_CLIENT_SECRET' | |
r= 'http://localhost:9000/' + self.provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function login () { | |
// get your specified redirect uri - usually window.location + '/uber' | |
var redirect_uri = '{your-url}' | |
// generate login url to get oauth code | |
var url = 'https://login.uber.com/oauth/v2/authorize?client_id='+ ENV['uber'] +'&response_type=code&scope=request+all_trips+profile&redirect_uri='+ redirect_uri; | |
// replace current url with new url | |
window.location.replace(url); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="bower_components/pusher-websocket-iso/dist/web/pusher.js"></script> | |
<script src="bower_components/pusher-angular/lib/pusher-angular.min.js"></script> | |
<script> | |
// in app.js | |
angular.module("YourApp",['pusher-angular']) | |
// in pusherService.js | |
(function () { |