Skip to content

Instantly share code, notes, and snippets.

View samccone's full-sized avatar
🐐

Sam Saccone samccone

🐐
  • Google
  • ∆∆∆<script>alert(prompt('why'))</script>
  • X @samccone
View GitHub Profile
orb.prototype.fill = function() {
return new Promise(function(resolve, reject) {
(function(tick, resolve) {
this.c.setAttribute("stroke-width", tick);
this.c.setAttribute("r", this.size - tick/2);
var r = arguments.callee;
window.requestAnimationFrame(function(t, resolve) {
if (this.size > t) {
r.call(this, t+1, resolve);
<html>
<style>
* {
margin: 0;
padding: 0;
}
</style>
<body>
<script>
{"title":"Finding the norm of a vector in Javascript","author":"jmeas","pages":[{"pageName":"","sections":[{"type":"text","source":"The norm, or magnitude, of a vector, is its length. In two dimensions, this can be represented in the following way:\n\n$$\\lVert v \\rVert = \\sqrt{x^2+y^2}$$\n\nIn Javascript, we could write a function to calculate this like so:\n\n```js\nfunction norm(x, y) {\n return Math.sqrt(x*x + y*y);\n}\n```\n\nLet's see an example of that:"},{"type":"javascript","source":"// Define the norm\nfunction norm(x, y) {\n return Math.sqrt(x*x + y*y);\n}\n\n// Calculate it\nvar val = norm(3, 4);\n\n// Set it to the output div\nvar output = document.getElementsByClassName('output')[0];\noutput.innerHTML = val;"},{"type":"html","source":"<!-- This is just a div to show our output -->\n\n<div class='output'></div>"},{"type":"css","source":"/* Let's give it some styling, too */\n\n.output {\n background: #eee;\n border: 1px solid #ddd;\n padding: 20px;\n}"}]}],"public":true}
@samccone
samccone / gist:86da2edeaabc2d2569ed
Created December 31, 2014 01:19
Marionette Meeting Notes 12.30.14
  • Sam Saccone

    • minor 2.3.1 release to fix html bug
    • new website is almost up to feature pairity
  • James kyle

    • new view ideas
      • investigation into a way to render children that are independent of their parent view render cycle, in an effort to optimize rendering and child view updates.
      • In step with this idea, questioning the idea of having a region and is it even needed?
data:text/html;charset=utf-8,<!DOCTYPE%20html><html%20lang%3D"en"><head><title>Advertisement%20Title<%2Ftitle><%2Fhead><body%20style%3D"margin%3A0px%3B%20padding%3A0px%3B%20margin-top%3A50px%3B%20"><iframe%20scrolling%3Dno%20seamless%3D"seamless"%20style%3D"overflow-y%3A%20hidden%3B%20border%3A0px%3B%20display%3Ablock%3B%20margin-left%3Aauto%3B%20margin-right%3Aauto%3B%20width%3A1200px%3B%20height%3A800px%3B"%20src%3D"http%3A%2F%2Fa.aproductmsg.com%2Fasw%2Fpir%2F305%2F2186033%2F1%2Fo.html%3Fcdm%3Dxads.zedo.com%26a%3D2186033%26x%3D3853%26g%3D172%26c1%3D305002125%26c2%3D305002125%26i%3D0%26n%3D305%26s%3D518%261%3D8%262%3D1%26tg%3D1423629425%26vr%3D1%26m%3D14%26w%3D43%26os%3D9%26p%3D8%26h%3D1425848%26f%3D3097535%26b%3D10%26o%3D20%26y%3D72%26v%3D1%26t%3Di%26u%3Dmmb%40D0bNSWCkCwOuJLRugw**~080814%26z%3D0.5684608246681243%26mb%3D13%26dm%3D.zedo.com%26pt%3DAdvertisement%26q%3D%26sk%3D%26l%3D%26cd%3D%26adm%3Dc13.zedo.com%26r%3D3%26ldm%3Dl1.zedo.com%26exp%3D0%26cm%3D%26tt%3D0%26wm%3DTransparent%26dnt%3D0%26tsad%3D0
<html>
<head>
</head>
<body>
<div id="app"></div>
</body>
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/lodash/index.js"></script>
<script src="node_modules/backbone/backbone.js"></script>
<script src="node_modules/backbone.marionette/lib/backbone.marionette.js"></script>
@samccone
samccone / gist:caf551221b58052bb57c
Created March 17, 2015 22:33
basic travis node setup
language: node_js
node_js:
- "0.12
@samccone
samccone / gist:78c4d9b9e0903d4567d7
Created March 17, 2015 23:21
a simple travis setup to boot a python server
language: node_js
before_script:
- python -m SimpleHTTPServer &
- sleep 2
node_js:
- "0.12"

Hey guys did another deep dive into an app's perf and I have some interesting dev-tools take aways...

Here are some things that were pretty darn hard to find. re: twosigma/beakerx#1546 (comment)

  1. when showing calls to methods that cause reflows or recalcs like ... get offsetWidth, it would be nice to highlight those methods calls in red or something, instead of showing the warning icon nested within it

  1. The other takeaway, or nice to have would be the ability to see a warning when you hit the max number of open network requests. Any kind of indicator in the network panel or debugger would be supppper nice
@samccone
samccone / gist:8c2dcf659f3b0b21a7ad
Last active August 29, 2015 14:20
count-change
(defn count-change [amount denominations]
(cond
; when no more money we win
(= amount 0) 1
; coins left and no money left? we lose
(= (count denominations) 0) 0
; start with the largest and work down
:else (let [sorted-denominations (-> denominations sort reverse)
; get the largest
d (first sorted-denominations)]