- When Gatsby starts up, it will read
gatsby-config.js
first. - As you can see below, we use that file to
require('ts-node').register()
which registers a TypeScript evaluator that will be used when Gatsby reads all other API Javascript files. In other words, we only need to do this once in our entire codebase and not in other Gatsby files likegatsby-node.js
. - Our
gatsby-config.js
re-exports all the exported variables available ingatsby-config.ts
.
declare module 'react-vis' { | |
import { | |
Component, | |
PureComponent, | |
ReactChild, | |
ReactNode, | |
SFC, | |
MouseEventHandler, | |
TouchEventHandler, |
/* Full tutorial: http://codevinsky.ghost.io/phaser-2-0-tutorial-flappy-bird-part-2/ */ | |
'use strict'; | |
var Bird = function(game, x, y, frame) { | |
Phaser.Sprite.call(this, game, x, y, 'bird', frame); | |
this.anchor.setTo(0.5, 0.5); | |
// add flap animation and begin playing it | |
this.animations.add('flap'); | |
this.animations.play('flap', 12, true); |
var self = window; | |
(function(self) { | |
var canvas, context, particles = [], explode = true, FPS = 60; | |
/* | |
* Init. | |
*/ | |
#!/bin/bash | |
# | |
# ssh into a machine and automatically set the background | |
# color of Mac OS X Terminal depending on the hostname. | |
# | |
# Installation: | |
# 1. Save this script to /usr/local/bin/ssh-host-color | |
# 2. chmod 755 /usr/local/bin/ssh-host-color | |
# 3. alias ssh=/usr/local/bin/ssh-host-color | |
# 4. export PRODUCTION_HOST="<hostname_production_server>" |
#!/usr/bin/env ruby | |
############################################################################### | |
# Required Application Libraries # | |
############################################################################### | |
%w{ rubygems optparse ostruct socket yaml }.each { |lib| require lib } | |
############################################################################### | |
I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.
From Require.js - Why AMD:
The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"
I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.
- Avoid too many reflows (the browser to recalculate everything)
- Use advanced CSS3 for graphic card rendering
- Precalculate sizes and positions
The reflow appens as many times as there are frames per seconds. It recalculate all positions that change in order to diplay them. Basically, when you scroll you execute a function where you move things between two reflows. But there are functions that triggers reflows such as jQuery offset, scroll... So there are two things to take care about when you dynamically change objects in javascript to avoid too many reflows:
# http://ruby-doc.org/stdlib-1.9.3/libdoc/net/smtp/rdoc/Net/SMTP.html | |
require 'digest/md5' | |
require 'mime/types' | |
require 'net/smtp' | |
require 'optparse' | |
require 'ostruct' | |
require 'yaml' | |
class Emailer |
add_filter("mce_external_plugins", "tomjn_mce_external_plugins"); | |
function tomjn_mce_external_plugins($plugin_array){ | |
$plugin_array['typekit'] = get_template_directory_uri().'/typekit.tinymce.js'; | |
return $plugin_array; | |
} |