forked from tessel/tessel.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 06933c0
Showing
391 changed files
with
21,054 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CELERY_ID="string" | ||
CELERY_TOKEN="string" | ||
CELERY_URL="url" | ||
TEST_CELERY_ID="string" | ||
TEST_CELERY_TOKEN="string" | ||
TEST_CELERY_URL="url" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Technical-io Static Web Pages | ||
|
||
This project is currently under revision. We're migrating to gulp, sass, and livereload capabilities. | ||
|
||
|
||
##Dev | ||
|
||
### Environment variables | ||
Environment variables examples can be found in `.env.example` | ||
|
||
You can also use the heroku plugin for config to pull down the environment variables from the server | ||
|
||
Install the plug in using: | ||
|
||
``` | ||
heroku plugins:install git://github.com/ddollar/heroku-config.git | ||
``` | ||
|
||
Pull down the environment variables with: | ||
|
||
``` | ||
heroku config:pull | ||
``` | ||
|
||
`npm run dev` will automatically use the .env file you have locally. You can also export the variables to your environment manually with `export $(cat .env | xargs)`. | ||
|
||
### Running the server locally | ||
|
||
|
||
``` | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
Be sure to install livereload plug-in to your chrome browser while developing. | ||
|
||
|
||
##Gulp | ||
Gulp is a task runner for development. While it can be used in production it's not advisable. Everything should be pre-compiled before it's pushed to heroku when using `npm run dev` | ||
|
||
##Sass | ||
Syntactically Awesome Style Sheets [docs](http://sass-lang.com/) | ||
|
||
We use Foundation, which has scss and JavaScript files in its npm package. | ||
|
||
##Jade | ||
HTML that sucks less [docs](http://jade-lang.com/) | ||
|
||
##Browserify | ||
|
||
Using browserify to combined and compress js files. [docs](http://browserify.org/) | ||
|
||
##data.json, faq.json | ||
|
||
Currently using this for a cms. Eventually we should move to something that does that.Gulp will watch for changes in json files so when you update the json the server will reload. This is allows us to use any of these attributes if we load them in as context for jade templates. | ||
|
||
Keep track of the size of these files as they are loaded into memory on server start. Make sure they don't start to get absurdly large. | ||
|
||
##aws.json | ||
|
||
To upload compressed images assets to AWS, fill out `aws.json` in accordance with <https://www.npmjs.com/package/gulp-s3>. | ||
|
||
##Celery | ||
|
||
Ensure you have a `.env` file. | ||
|
||
In production, set the env variables `CELERY_URL` and `CELERY_TOKEN`. | ||
|
||
In development, set the `TEST_CELERY_URL`, `TEST_CELERY_TOKEN`, and `TEST_CELERY_ID` variables. | ||
|
||
##Deployment | ||
###server | ||
This document does says it best [Heroku git deploy](https://devcenter.heroku.com/articles/git) | ||
|
||
First you must be sure to have [heroku toolbelt](https://toolbelt.heroku.com/) installed. | ||
|
||
Make sure that you have these remotes to your local git clone. | ||
|
||
``` | ||
git remote add heroku https://git.heroku.com/technical-io.git | ||
git remote add stage https://git.heroku.com/technical-io-stage.git | ||
``` | ||
|
||
Login to heroku using the Mitro credentials for heroku | ||
|
||
``` | ||
heroku login | ||
``` | ||
|
||
**We only ever deploy the master branch to the production server.** | ||
To deploy to production: | ||
``` | ||
git push heroku master | ||
``` | ||
|
||
To deploy to stage: | ||
``` | ||
git push stage [branch-name]:master | ||
``` | ||
|
||
|
||
And that's it, Heroku is awesome. (except when it doesn't put node in the environment path) | ||
|
||
**Be sure the environment variables are set on the server.** | ||
|
||
Specifically these and everything in .env.example | ||
|
||
``` | ||
PATH = bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin | ||
NODE_ENV = production | ||
NPM_CONFIG_PRODUCTION = false | ||
``` | ||
|
||
###Images and Scripts | ||
Be sure to install the AWS cli | ||
[install aws cli](http://docs.aws.amazon.com/cli/latest/userguide/installing.html) | ||
|
||
Safest way is to use the bundler if you're on Linux or OS X [installing on linux](http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os) | ||
|
||
include an aws.json file | ||
|
||
``` | ||
{ | ||
"accessKeyID": "TM-accessID", | ||
"secretAccessKey": "TM-secret-access-key", | ||
"bucket": "technicalmachine-assets/launch" | ||
} | ||
``` | ||
|
||
commands to download assets | ||
``` | ||
gulp images-download | ||
``` | ||
command to encoding optimize and upload images | ||
|
||
``` | ||
gulp images-upload | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "technical-io", | ||
"main": "index.js", | ||
"version": "0.0.0", | ||
"homepage": "https://github.com/technicalmachine/technical-io", | ||
"authors": [ | ||
"HarleyKwyn <[email protected]>" | ||
], | ||
"license": "MIT", | ||
"private": true, | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"inuit-defaults": "0.2.1", | ||
"inuit-spacing-responsive": "0.0.5", | ||
"inuit-spacing": "0.6.2", | ||
"slick-carousel": "1.4.1", | ||
"foundation": "5.5.1", | ||
"jquery": "2.1.3", | ||
"jquery.transit": "0.9.12" | ||
}, | ||
"resolutions": { | ||
"jquery": "2.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
var request = require("request"); | ||
var dotty = require("dotty"); | ||
var defaults = require("lodash.defaults"); | ||
|
||
var Celery = function(config){ | ||
this.config = this.setConfig(config); | ||
this.options = null; | ||
this.cache = {}; | ||
}; | ||
|
||
Celery.prototype.request = function(options, callback) { | ||
var now = new Date(); | ||
var self = this; | ||
options = self.setOptions(options); | ||
if(self.config.caching){ | ||
if(dotty.exists(self.cache, options.url)){ | ||
var cache = self.cache[options.url]; | ||
if(self.cache[options.url].date - now < self.options.cacheLength){ | ||
return callback(cache.error, cache.response, cache.body); | ||
} | ||
self.cache[options.url] = now; | ||
} | ||
self.cache[options.url] = { | ||
date: now | ||
}; | ||
} | ||
request(options, function(error,response,body) { | ||
if(self.config.caching){ | ||
self.cache[options.url] = { | ||
error: error, | ||
response: response, | ||
body: body | ||
} | ||
} | ||
|
||
if (error) { | ||
return callback(error, response, body); | ||
} | ||
|
||
if (response && dotty.exists(response, "statusCode")) { | ||
return callback(false, response, body); | ||
} | ||
|
||
return callback("no response status code", response, body); | ||
}); | ||
}; | ||
|
||
Celery.prototype.setConfig = function(config) { | ||
if(typeof(config) === "string"){ | ||
this.config = { | ||
"key":config | ||
}; | ||
}else if(typeof(config) == "undefined"){ | ||
this.config = {}; | ||
} | ||
|
||
this.config = defaults(config,{ | ||
"baseurl": 'https://api.trycelery.com', | ||
"version": 2, | ||
}); | ||
|
||
return this.config; | ||
}; | ||
|
||
|
||
|
||
Celery.prototype.setOptions = function(options) { | ||
if (typeof(options) === "string"){ | ||
options = { | ||
"url":options | ||
}; | ||
} | ||
else if(typeof(options) == "undefined"){ | ||
options = {}; | ||
} | ||
|
||
if(dotty.exists(options,"url")){ | ||
// Trim trailing slash if included | ||
options.url = (options.url.match(/^\//)) ? options.url.substring(1,options.url.length) : options.url; | ||
// Create api url out of version and options url | ||
options.url = this.config.baseurl + "/v" + this.config.version + "/" + options.url; | ||
} | ||
|
||
this.options = defaults(options,{ | ||
"caching": false, | ||
"cacheLength": 36000, | ||
"url": this.config.baseurl + "/v" + this.config.version + "/", | ||
"method": "GET", | ||
"json" : true, | ||
"headers":{ | ||
"Content-Type": "application/json", | ||
"Authorization" : this.config.key | ||
}, | ||
}); | ||
return this.options; | ||
}; | ||
|
||
module.exports = Celery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"AF":"Afghanistan","AL":"Albania","DZ":"Algeria","AS":"American Samoa","AD":"Andorra","AO":"Angola","AI":"Anguilla","AQ":"Antarctica","AG":"Antigua and Barbuda","AR":"Argentina","AM":"Armenia","AW":"Aruba","AU":"Australia","AT":"Austria","AZ":"Azerbaijan","BS":"Bahamas","BH":"Bahrain","BD":"Bangladesh","BB":"Barbados","BY":"Belarus","BE":"Belgium","BZ":"Belize","BJ":"Benin","BM":"Bermuda","BT":"Bhutan","BO":"Bolivia","BA":"Bosnia and Herzegovina","BW":"Botswana","BV":"Bouvet Island","BR":"Brazil","BQ":"British Antarctic Territory","IO":"British Indian Ocean Territory","VG":"British Virgin Islands","BN":"Brunei","BG":"Bulgaria","BF":"Burkina Faso","BI":"Burundi","KH":"Cambodia","CM":"Cameroon","CA":"Canada","CT":"Canton and Enderbury Islands","CV":"Cape Verde","KY":"Cayman Islands","CF":"Central African Republic","TD":"Chad","CL":"Chile","CN":"China","CX":"Christmas Island","CC":"Cocos [Keeling] Islands","CO":"Colombia","KM":"Comoros","CG":"Congo - Brazzaville","CD":"Congo - Kinshasa","CK":"Cook Islands","CR":"Costa Rica","HR":"Croatia","CU":"Cuba","CY":"Cyprus","CZ":"Czech Republic","CI":"C\u00f4te d\u2019Ivoire","DK":"Denmark","DJ":"Djibouti","DM":"Dominica","DO":"Dominican Republic","NQ":"Dronning Maud Land","DD":"East Germany","EC":"Ecuador","EG":"Egypt","SV":"El Salvador","GQ":"Equatorial Guinea","ER":"Eritrea","EE":"Estonia","ET":"Ethiopia","FK":"Falkland Islands","FO":"Faroe Islands","FJ":"Fiji","FI":"Finland","FR":"France","GF":"French Guiana","PF":"French Polynesia","TF":"French Southern Territories","FQ":"French Southern and Antarctic Territories","GA":"Gabon","GM":"Gambia","GE":"Georgia","DE":"Germany","GH":"Ghana","GI":"Gibraltar","GR":"Greece","GL":"Greenland","GD":"Grenada","GP":"Guadeloupe","GU":"Guam","GT":"Guatemala","GG":"Guernsey","GN":"Guinea","GW":"Guinea-Bissau","GY":"Guyana","HT":"Haiti","HM":"Heard Island and McDonald Islands","HN":"Honduras","HK":"Hong Kong SAR China","HU":"Hungary","IS":"Iceland","IN":"India","ID":"Indonesia","IR":"Iran","IQ":"Iraq","IE":"Ireland","IM":"Isle of Man","IL":"Israel","IT":"Italy","JM":"Jamaica","JP":"Japan","JE":"Jersey","JT":"Johnston Island","JO":"Jordan","KZ":"Kazakhstan","KE":"Kenya","KI":"Kiribati","KW":"Kuwait","KG":"Kyrgyzstan","LA":"Laos","LV":"Latvia","LB":"Lebanon","LS":"Lesotho","LR":"Liberia","LY":"Libya","LI":"Liechtenstein","LT":"Lithuania","LU":"Luxembourg","MO":"Macau SAR China","MK":"Macedonia","MG":"Madagascar","MW":"Malawi","MY":"Malaysia","MV":"Maldives","ML":"Mali","MT":"Malta","MH":"Marshall Islands","MQ":"Martinique","MR":"Mauritania","MU":"Mauritius","YT":"Mayotte","FX":"Metropolitan France","MX":"Mexico","FM":"Micronesia","MI":"Midway Islands","MD":"Moldova","MC":"Monaco","MN":"Mongolia","ME":"Montenegro","MS":"Montserrat","MA":"Morocco","MZ":"Mozambique","MM":"Myanmar [Burma]","NA":"Namibia","NR":"Nauru","NP":"Nepal","NL":"Netherlands","AN":"Netherlands Antilles","NT":"Neutral Zone","NC":"New Caledonia","NZ":"New Zealand","NI":"Nicaragua","NE":"Niger","NG":"Nigeria","NU":"Niue","NF":"Norfolk Island","KP":"North Korea","VD":"North Vietnam","MP":"Northern Mariana Islands","NO":"Norway","OM":"Oman","PC":"Pacific Islands Trust Territory","PK":"Pakistan","PW":"Palau","PS":"Palestinian Territories","PA":"Panama","PZ":"Panama Canal Zone","PG":"Papua New Guinea","PY":"Paraguay","YD":"People's Democratic Republic of Yemen","PE":"Peru","PH":"Philippines","PN":"Pitcairn Islands","PL":"Poland","PT":"Portugal","PR":"Puerto Rico","QA":"Qatar","RO":"Romania","RU":"Russia","RW":"Rwanda","RE":"R\u00e9union","BL":"Saint Barth\u00e9lemy","SH":"Saint Helena","KN":"Saint Kitts and Nevis","LC":"Saint Lucia","MF":"Saint Martin","PM":"Saint Pierre and Miquelon","VC":"Saint Vincent and the Grenadines","WS":"Samoa","SM":"San Marino","SA":"Saudi Arabia","SN":"Senegal","RS":"Serbia","CS":"Serbia and Montenegro","SC":"Seychelles","SL":"Sierra Leone","SG":"Singapore","SK":"Slovakia","SI":"Slovenia","SB":"Solomon Islands","SO":"Somalia","ZA":"South Africa","GS":"South Georgia and the South Sandwich Islands","KR":"South Korea","ES":"Spain","LK":"Sri Lanka","SD":"Sudan","SR":"Suriname","SJ":"Svalbard and Jan Mayen","SZ":"Swaziland","SE":"Sweden","CH":"Switzerland","SY":"Syria","ST":"S\u00e3o Tom\u00e9 and Pr\u00edncipe","TW":"Taiwan","TJ":"Tajikistan","TZ":"Tanzania","TH":"Thailand","TL":"Timor-Leste","TG":"Togo","TK":"Tokelau","TO":"Tonga","TT":"Trinidad and Tobago","TN":"Tunisia","TR":"Turkey","TM":"Turkmenistan","TC":"Turks and Caicos Islands","TV":"Tuvalu","UM":"U.S. Minor Outlying Islands","PU":"U.S. Miscellaneous Pacific Islands","VI":"U.S. Virgin Islands","UG":"Uganda","UA":"Ukraine","SU":"Union of Soviet Socialist Republics","AE":"United Arab Emirates","GB":"United Kingdom","US":"United States","ZZ":"Unknown or Invalid Region","UY":"Uruguay","UZ":"Uzbekistan","VU":"Vanuatu","VA":"Vatican City","VE":"Venezuela","VN":"Vietnam","WK":"Wake Island","WF":"Wallis and Futuna","EH":"Western Sahara","YE":"Yemen","ZM":"Zambia","ZW":"Zimbabwe","AX":"\u00c5land Islands"} |
Oops, something went wrong.