Skip to content

Instantly share code, notes, and snippets.

@mako-taco
mako-taco / union.ts
Last active January 26, 2021 06:51
Union Types For Logging Events
enum EventType {
SEARCH,
PROFILE_UPDATE,
CART_UPDATE
}
type Event =
| {type: EventType.SEARCH; query: string}
| {type: EventType.PROFILE_UPDATE; fields: string[]}
| {type: EventName.CART_UPDATE; newSubtotal: number; oldSubtotal: number}
@mako-taco
mako-taco / gulpfile.js
Created October 3, 2014 14:19
Example Gulpfile
gulp.task('sass', function () {
gulp.src('app/styles/**/*.scss')
.pipe(sass())
.pipe(autoprefixer('last 1 version'))
.pipe(gulp.dest('dist/styles'));
});
gulp.task('default', function() {
gulp.run('sass');
gulp.watch('app/styles/**/*.scss', function() {
@mako-taco
mako-taco / gruntfile.js
Created October 3, 2014 14:18
Example Gruntfile
grunt.initConfig({
sass: {
dist: {
files: [{
cwd: 'app/styles',
src: '**/*.scss',
dest: '../.tmp/styles',
expand: true,
ext: '.css'
}]
@mako-taco
mako-taco / api.md
Last active June 28, 2018 07:34
Single page app addthis api

#API for single page app use

###addthis.layers.refresh()

  • Updates the share URL of all floating tools (sharing sidebar, for instance) to the current URL
  • Creates inline tools on any elements that do not yet have a tool rendered for it

I can see someone with a single page app doing one of two scenarios:

//always refresh on URL change
@mako-taco
mako-taco / gist:9488478
Created March 11, 2014 15:44
Lessening our memory footprint
//So we can totally use prototypes with knockout! Here's how...
var FloorElement = function () {
this.normalObservable = ko.observable("no optimization here");
this.computedObservable = ko.computed(this.functionOnPrototype);
}
FloorElement.prototype.functionOnPrototype = function () {
/* this is very obvious in retrospect. Also lets us manually call some of these things,
which can be worthwhile. */
}
// Muscle Memory (Command-based)
Command + A (Select , Esc to exit)
Command + B (Run Build)
Command + C (Copy)
Command + D (Selects the word the cursor is on, Press it again to create another cursor on the next selection)
Command + F (Open Find Console)
Command + G (to jump/move cursor forward from one Search result to next)
Command + H (Hide Sublime Text)
Command + I (Incremental find)
Command + J (Join Line)