This file contains hidden or 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
app.get('/auth/callback', function(req,res){ | |
var optAuthorize = { | |
url: config.url_oauth, | |
method: 'POST', | |
form: { | |
grant_type: 'authorization_code', | |
code: req.query.code, | |
client_id: config.client_id, | |
client_secret: config.client_secret |
This file contains hidden or 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 fs = require('fs'); | |
var request = require('request'); | |
var Box = require('./controllers/BoxControllers'); | |
var box = new Box({ | |
access_token: "duPlRu6eWRWJ42sIEb6Mlc2fUdjx4uRL", | |
refresh_token: "mPZjuJZxqitdfbSWO7TU2IgxmXuZvF4Ge0bB328jCnL3h3SvMQpmobKx93xajUEi" | |
}); | |
request.post('https://upload.box.com/api/2.0/files/content', { |
This file contains hidden or 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 getTileData = require('./modules/get-panorama-tiles'); | |
var panorama = require('./modules/get-panorama-by-location'); | |
var getPanoURL = require('./modules/get-pano-url'); | |
var Canvas = require('canvas'); | |
var request = require('request'); | |
var Image = require('canvas').Image; | |
var express = require('express'); | |
var app = express(); | |
var fs = require('fs'); |
This file contains hidden or 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
module.exports = streetViewUrl; | |
function streetViewUrl (panoId, opt) { | |
opt = opt || {}; | |
var x = opt.x || 0; | |
var y = opt.y || 0; | |
var zoom = opt.zoom || 0; | |
// alternative: | |
// return 'https://cbks2.google.com/cbk?cb_client=maps_sv.tactile&authuser=0&hl=en&panoid=' + id + '&output=tile&zoom=' + zoom + '&x=' + x + '&y=' + y + '&' + Date.now() | |
return 'https://geo0.ggpht.com/cbk?cb_client=maps_sv.tactile&authuser=0&hl=en&panoid=' + panoId + '&output=tile&x=' + x + '&y=' + y + '&zoom=' + zoom + '&nbt&fover=2'; | |
} |
This file contains hidden or 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 post in site.posts limit:10 %} | |
<div class="post-preview"> | |
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2> | |
<div class="post-date">{{ post.date | date: "%B %d, %Y" }}</div> | |
{% if post.content.size > 2000 %} | |
{{ post.content | truncatewords: 300 }} <!-- bad! content gives you rendered html and you will truncate in the middle of a node --> | |
<a href="{{ post.url }}">read more</a> | |
{% else %} | |
{{ post.content }} | |
{% endif %} |
This file contains hidden or 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 post in site.posts limit:10 %} | |
<div class="post-preview"> | |
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2> | |
<div class="post-date">{{ post.date | date: "%B %d, %Y" }}</div> | |
{{ post.content | split:'<!--break-->' | first }} | |
{% if post.content contains '<!--break-->' %} | |
<a href="{{ post.url }}">read more</a> | |
{% endif %} | |
</div> | |
<hr> |
This file contains hidden or 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
public static function getAccessToken($url, $code) | |
{ | |
$options = XenForo_Application::get('options'); | |
if (!$options->facebookAppId) | |
{ | |
return false; | |
} | |
try |
This file contains hidden or 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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
This file contains hidden or 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
/* | |
* app.js | |
* @toanalien | |
*/ | |
var Emitter = require('./emitter'); | |
var emtr = new Emitter(); | |
emtr.on('sayhello', function() { | |
console.log('hello world !'); |
This file contains hidden or 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
/* | |
* inherits.js | |
* @toanalien | |
*/ | |
var util = require('util'); | |
var EventEmitter = require('events'); | |
function Toanalien() { | |
this.toanalien = "Hello !"; |