Skip to content

Instantly share code, notes, and snippets.

View dustintheweb's full-sized avatar
🎯
Focusing

Dustin Hoffmann dustintheweb

🎯
Focusing
View GitHub Profile
@dustintheweb
dustintheweb / app.yaml
Last active December 2, 2015 10:10 — forked from cagatay/app.yaml
Google App Engine (Python) - app.yaml for hosting a static site
application: your-app-name
version: 1
runtime: python27
api_version: 1
threadsafe: true
default_expiration: "30d"
handlers:
# web files
@dustintheweb
dustintheweb / google-app-engine-cloud-git-sourcetree.md
Last active November 26, 2021 08:13
Set up a Google Cloud Git Repo in SourceTree

###Setting up a Google Cloud Git Repo // now with SourceTree bonus!
*Note: this guide is relavent only to repos natively hosted on Google Cloud


**Prereq:** - OSX - SourceTree - git - A Google App Engine / Cloud project
@dustintheweb
dustintheweb / app.yaml
Last active August 29, 2015 14:03
Create a simple CDN with Google App Engine
application: your-app-cdn
version: 1
api_version: 1
runtime: python27
threadsafe: true
handlers:
# web files
- url: /(.*\.css)
mime_type: text/css
@dustintheweb
dustintheweb / show-namespace-global-variables
Created August 15, 2014 20:18
Javascript - Show All Global Variables Assigned to a Specific Namespace
for(var g in window) {
if(window.hasOwnProperty(g)) console.log(g);
}
// replace window with custom namespace if needed
@dustintheweb
dustintheweb / self-hosted-font-face-stack-android-stock-browser-fix.css
Last active August 29, 2015 14:06
Self Hosted @font-face Webfont Stack With Stock Android Browser Fix
@font-face {
font-family:"FontName";
src:url("fonts/fontname.eot");
src:url("fonts/fontname.eot?#iefix") format("eot"),url("fonts/fontname.woff") format("woff"),url("fonts/fontname.ttf") format("truetype"),url("fonts/fontname.svg#fontname") format("svg");
font-weight: 400;
font-style: normal;
}
@media screen and (-webkit-min-device-pixel-ratio:0) { // android fix
@font-face {
font-family:"FontName";
Verifying that +dustintheweb is my openname (Bitcoin username). https://onename.io/dustintheweb
@dustintheweb
dustintheweb / index.html
Created February 28, 2015 11:14
AngularJS: Toggle an external class from a click event inside of an include
<!doctype html>
<html ng-app="myApp">
<head>...</head>
<body ng-controller="myController" ng-class="toggleClass ? 'click-active' : 'click-inactive'">
<div ng-include="/path/myInclude.html"></div>
</body>
</html>
@dustintheweb
dustintheweb / index.html
Created February 28, 2015 11:43
AngularJS: Multiple ternary statements in ng-class
<!doctype html>
<html ng-app="myApp">
<head>...</head>
<body ng-controller="myController" ng-class="(toggleClass1 ? 'class-1' : '')+' '+(toggleClass2 ? 'class-2' : '')">
<div>
stuff...
<div class="button1" ng-click="$toggleClass1 = !$toggleClass1"></div>
stuff...
<div class="button2" ng-click="$toggleClass2 = !$toggleClass2"></div>
</div>
@dustintheweb
dustintheweb / headroom-smart-offset.js
Created March 19, 2015 19:16
Headroom Smart Offset
// -- headroom ---------------
(function($) {
var headOffset = (app.obj.$section.filter('.feature').height() / 2) - (app.obj.$header.height());
app.obj.$header.headroom({
'offset': headOffset,
'tolerance': 5,
'classes': {
'initial': 'animated',
'pinned': 'slideDown',
'unpinned': 'slideUp'
@dustintheweb
dustintheweb / 29392738.md
Created April 2, 2015 16:32
Solution: Correctly configuring a static site with advanced routing - http://stackoverflow.com/posts/29392738

Ok I finally have this figured out.

First off, if you aren't familiar with the way GAE handles templating... it's a bit different than you would expect, but a pillar of getting this to work correctly.

This is what you want at the bottom of your app.yaml

- url: /
  static_files: dist/index.html
  upload: dist/index.html

expiration: "15m"