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
<div class="row"> | |
<div class="col-md-2 col-sm-2 col-xs-2"> | |
<p><button class="btn btn-primary btn-sm" id="map-address-btn"><span>Find It</span></button></p> | |
</div><!-- .col --> | |
<div class="col-md-10 col-sm-10 col-xs-10"> | |
<div class="panel panel-default"> | |
<div class="panel-heading">Location Response</div> | |
<div class="panel-body"> | |
<p>Enter Address: <input id="location-address" type="text" class="form-control" placeholder="Street, City, State"/</p> | |
<p>Map:</p><div id="map-canvas" style="height: 400px;"></div> |
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
CREATE TABLE `countries` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`printable_name` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM AUTO_INCREMENT=240 DEFAULT CHARSET=utf8; |
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
# Use one of the download links here: http://phantomjs.org/download.html | |
# In this case, it's the 32-bit version. | |
sudo yum install freetype fontconfig | |
cd ~ | |
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2 | |
bunzip2 phantomjs*.tar.bz2 | |
tar xvf phantomjs*.tar | |
sudo cp phantomjs*/bin/phantomjs /usr/bin/phantomjs | |
phantomjs -v |
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
Let's lool at the following example structure for RESTful API using Node.js, Express.js included tesing | |
app/ | |
|---models/ | |
|---controller/ | |
|---helpers/ | |
|---middlewares/ | |
|---tests/ | |
|---models/ | |
|---controllers/ |
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
{ | |
"apps": [{ | |
"name": "Application", | |
"exec_interpreter": "./node_modules/babel-cli/bin/babel-node.js", | |
"script": "./bin/www", | |
"args": [], | |
"watch": ["public", "package.json", "pm2.development.json"], | |
"ignore_watch": ["public"], | |
"watch_options": { | |
"persistent": true, |
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
# for development | |
pm2 start npm --name "next" -- run dev | |
# for production | |
npm run build | |
pm2 start npm --name "next" -- start | |
"scripts": { | |
"start": "node ./node_modules/.bin/pm2 start app.js -i max --attach" |
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
var url = "http://cdn1.giltcdn.com/images/share/uploads/0000/0001/7250/172502872/420x560.jpg"; | |
var encoded = new Buffer(url).toString('base64'); | |
var decoded = new Buffer(encoded, 'base64').toString('ascii') | |
console.log(encoded); | |
console.log(decoded); |
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
// start with at string | |
var s = "my string"; | |
//change its value (remember this changing of value is by value not reference) | |
s.toUpperCase(); | |
// assign it to t | |
var t = s; |
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
/* | |
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties | |
JSX USAGE: <Iframe src='http://web.site' onLoad={myOnloadFunction}/> | |
*/ | |
import React, { Component, PropTypes } from 'react' | |
import ReactDOM from 'react-dom' | |
class Iframe extends Component { | |
static propTypes: Object = { |
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
pm2 start app.js --interpreter ./node_modules/.bin/babel-node |
OlderNewer