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
/** | |
* Calculates whether a ray intersects a circle. If it does, it returns the intersection point, the angle of reflection, and the distance from the origin of the ray. | |
* @param {Object} origin {x, y} | |
* @param {Number} angle | |
* @param {Object} circle {x, y, r} | |
* @returns {Object} {x, y, angle, dist} | null | |
* | |
*/ | |
const rayCircleIntersection = (origin, angle, circle) => { |
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
/** 1. Create a features.js script that has one method function calculateFeatures(tokenData) {...}. You will need this for Artblocks anywayz. | |
2. Add this line to the bottom: export default calculateFeatures; | |
3. Copy the contents of this gist into generate-features-json.js | |
4. In your terminal, run node generate-features-json.js. | |
5. The script will take a minute to generate 2,000 outcomes and compile all of the different traits. | |
6. Tada. features.json can be uploaded to Artblocks. | |
**/ | |
import fs from 'fs'; | |
import calculateFeatures from './features.js' |
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
const replace = require('replace-in-file'); | |
let files = 'dist/main.js'; //Add your sketch file here. | |
let from = [ //Add your keywords that you want to replace here! | |
/grainHigh/g, | |
/grainLow/g, | |
/shadowColor/g, | |
] |
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
window.intersectionCount = 0; | |
function trimLine(polyline, polygon){ | |
if (!polyline.length){ | |
return {true:[],false:[]}; | |
} | |
let zero = segmentIntersectPoly(...polyline[0],polyline[0][0]+Math.E,polyline[0][1]+PI,polygon,true).length % 2 != 0; | |
let out = { | |
'true' :[[]], | |
'false':[[]], | |
} |
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
const webpack = require('webpack'); | |
const path = require('path'); | |
const isProduction = process.env.NODE_ENV === 'production'; | |
const fs = require('fs'); | |
const babelConfig = require('./babel.config'); | |
//Root cartridge folder. | |
const cartridgePath = path.join(__dirname, 'cartridges', 'my_app', 'cartridge'); | |
const modulesPath = path.join(__dirname, 'node_modules'); |
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
const React = require('react'); | |
const ReactDOM = require('react-dom'); | |
const URI = require('urijs'); | |
const cssVariables = require('partials/_variables.scss'); | |
const snappable = require('./modules/ui/components/snappable'); | |
const scroll = require('./modules/ui/components/scroll-to-position'); | |
const acceptCookieAlert = require('./modules/ui/bottom-message-alert'); | |
const responsive = require('./modules/util/responsive'); | |
const deepMerge = require('./modules/util/deep-merge'); |
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 testData = { | |
'endorsedItemName-0':'Open Innovation', | |
'endorsedItemType-0':'skill', | |
'endorsedItemId-0':'7291', | |
'recipientType-0':'member', | |
'recipientId-0': userIDs[step], | |
'endorse':'Endorse', | |
'endorsementCount':'1' | |
}; |
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
<div class="container"> | |
<div class="row"> | |
<div class="col-sm-8"> ... </div> | |
<div class="col-sm-4"> ... </div> | |
</div> | |
</div> | |
<div class="container-full"> | |
<div class="row"> | |
<div class="col-sm-12 no-gutter"> I span 100%! </div> | |
</div> |
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($){ | |
var sway = { | |
ease:6, | |
mobileWidth:767, | |
container: $(".interactive-piece"), | |
elements: null, | |
active:false, | |
currX:0, | |
currY:0, |