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 express = require('express'); | |
var router = express.Router(); | |
var bodyParser = require('body-parser'); | |
var jwtauth = require('../../../jwtauth.js'); | |
router.get('/', [bodyParser(), jwtauth], function(req, res) { | |
//jwtauth is run automatically and will populate req.user if there is a valid token supplied | |
if(!req.user) { | |
res.status(401).send({error: "Unauthorized access"}); | |
return |
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 jwt = require('jwt-simple'); | |
var config = require('yaml-config'); | |
var settings = config.readConfig('./config/app.yaml'); | |
var username = settings.rabbitmq.username; | |
var password = settings.rabbitmq.password; | |
var url = settings.rabbitmq.url; | |
var port = settings.rabbitmq.port; | |
var rpc = require('amqp-rpc').factory({ |
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 rpc = require('amqp-rpc').factory({ | |
url: "amqp://guest:guest@localhost:5672" | |
}); | |
module.exports = function(req, res, next) { | |
var jwt = require('jwt-simple'); | |
token = (req.body && req.body.access_token) || (req.query && req.query.access_token) || req.headers['x-access-token']; | |
rpc.call('profile.confirmToken', {token: token}, function(result, user, msg) { |
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
## RubyMotion | |
imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1) | |
encodedData = [imageData].pack("m0") | |
data["image"] = encodedData | |
BW::HTTP.post("http://localhost:3000/upload}", {payload: data}) do |response| | |
if response.ok? | |
end | |
end |
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 function editAboutMe_ajax($params) { | |
$this->show_layout = false; | |
$resp = new SilkAjax(); | |
$this->set("params", $params); | |
$this->set("formType", "edit"); | |
$resp->replace_html("#AboutMe", $this->render_partial("edit_about_me_ajax.tpl")); | |
return $resp->get_result(); | |
} |
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
$friendsActivity = orm("UserActivity")->find_all(array("join" => array("INNER JOIN silk_friends on friends.user_id = silk_user_activity.user_id"), "conditions" => array("friends.user_id = ?", $params["user_id"]))); |
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
<?php | |
class mpUser extends SilkUser { | |
public function __construct(){ | |
parent::__construct(); | |
} | |
public function setup() { | |
$this->create_has_many_association("friends", "Friend", "user_id"); | |
$this->create_has_many_association("activity", "UserActivity", "user_id"); | |
// $this->create_belongs_to_association("activity", "user_activity", "user_id"); |
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
object(__PHP_Incomplete_Class)#3 (16) { | |
["__PHP_Incomplete_Class_Name"]=> | |
string(6) "mpUser" | |
["params"]=> | |
array(11) { | |
["id"]=> | |
string(2) "26" | |
["username"]=> | |
string(9) "braindead" | |
["password"]=> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<title>{$title}</title> | |
{javascript file="lib/silk/jquery/jquery.js"} | |
{javascript file="lib/silk/jquery/jquery.color.js"} | |
{javascript file="lib/silk/jquery/jquery.silk.js"} | |
{stylesheet} |
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
/** | |
* Fills an object with posted form variables | |
* | |
* @param array Contains hash of values to load into the object (used in conjunction with SilkForm::auto_form) | |
*/ | |
function fill_object_form($params) { | |
foreach($params as $key=>$value) { | |
$this->$key = $value; | |
} | |
} |
NewerOlder