Scone Fiddler
Wankmaggot General
Twatbiscuit
Westminster Flabby
DJ Tranny
# .github/workflows/ci.yml | |
name: CI | |
on: [push] | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
test-chunks: ${{ steps['set-test-chunks'].outputs['test-chunks'] }} | |
test-chunk-ids: ${{ steps['set-test-chunk-ids'].outputs['test-chunk-ids'] }} | |
steps: |
Scone Fiddler
Wankmaggot General
Twatbiscuit
Westminster Flabby
DJ Tranny
// income tax | |
const base_income = // annual income before any tax | |
const federal_tax_rate = // 0.xx format | |
const state_tax_rate = // 0.xx format | |
// property tax | |
const monthly_rent = // dollar amount per month | |
const property_tax_rate = 0.18 // in new jersey at least | |
// medical tax | |
const monthly_health_insurance = // dollar amount per month | |
// consumption tax |
// determines number of times you should roll a die to determine if it is "fair" | |
const find_number_of_rolls = (number_of_sides, required_confidence) => { | |
const allowed_deviation = 1 - required_confidence | |
const expected_value_per_side = 1/allowed_deviation | |
const rolls = expected_value_per_side * number_of_sides | |
return Math.round(rolls) | |
} | |
// rolls array takes the form: value_of_side(int)[] |
const safe_read = (object, property) => { | |
try { | |
return property.split('.').reduce((acc, current) => {return acc[current] || undefined}, object) | |
} catch(e) { | |
return null | |
} | |
} |
I've seen others struggle(and have struggled myself) with media queries and gigantic CSS files separately and together. I recently learned that CSS import statements support media queries and have done so for a long time (see: https://developer.mozilla.org/en-US/docs/Web/CSS/@import). In other implementations I've seen this ability being used for including external stylesheets into a stylesheet the developer actually controls. I'd like to propose a system where developers use CSS imports by default in order to minimize the amount of data sent to clients and in order to better structure our CSS. An example index.css file and small.css (included file) is show in this gist. Structuring our files this way means that the initial CSS payload is only 306 bytes. Anything more than that is only included if it's relevant to the current client. We can also inline this initial block into the `` of the html removing a single network request from the initial
so, in earlier angular1 code, we would list all of the dependencies of a controller in an array where the last item in the array is the controller to inject them into. it looked like this:
someModule.controller('MyController', ['$scope', 'dep1', 'dep2', function MyController ($scope, dep1, dep2) {
// do something...
}]);
this pattern works but it's ...not great. right? tons of nesting, repetition, people unfamiliar with javascript would be very confused. so then we started using injection syntax.
// assume this is our original translate function | |
const translate = (key) => { | |
return key.split('.').reduce((acc, current) => { | |
return acc[current]; | |
}, english); | |
} | |
// an example of a dictionary of i18n strings with nested properties | |
const english = { | |
foo: { |
((global) => { | |
function getTemplate () { | |
return fetch('http://backend-php-test.prod.dcos.triplelift.net/ad-experience/template') | |
.then(function(response) { | |
return response.json(); | |
}); | |
} | |
function getContent () { |
/* what do each of these statements return? | |
(assume that they are evaluated individually but in order.) | |
*/ | |
const foo = 'asdf'; //=> ? | |
foo.bar = 12345; //=> ? | |
foo; //=> ? |