Skip to content

Instantly share code, notes, and snippets.

splitChunks: {
minSize: 0,
maxSize: 0,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
cacheGroups: {
styles: {
name: 'styles',
test: /\.(css|scss)$/,
@dortzur
dortzur / 0_reuse_code.js
Created October 5, 2016 16:39
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
@dortzur
dortzur / reddit-scripts.js
Last active January 18, 2021 23:20
Reddit "Hot Story" and "Best Comments" algorithms in JavaScript
//Based off of https://medium.com/hacking-and-gonzo/how-reddit-ranking-algorithms-work-ef111e33d0d9
function hotStory(ups, downs,date){
const score = ups - downs;
const order = Math.log(Math.max(Math.abs(score), 1), 10);
const sign = score > 0 ? 1 : ((score < 0) ? -1 : 0);
const seconds = (date.getTime()/1000) - 1134028003;
return Math.round(sign * order + seconds / 45000, 7);
}
@dortzur
dortzur / example.html
Created September 28, 2011 21:23 — forked from joelnet/example.html
Unobtrusive Knockout support library for jQuery
Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}