Skip to content

Instantly share code, notes, and snippets.

View RubyRonin's full-sized avatar

Ruby Ronin RubyRonin

View GitHub Profile
passport.use('custom-login', new Custom(function (req, done) {
var email = req.param('email'),
pw = req.param('password');
User.findOne({"local.email": email}, function (err, usr) {
if (err){
console.log(err);
return done(err);
}
if (!usr)
{
function LoadDetails() {
mEntity = GetParameterByName('addressforhistory');
var apiurl = "";
if (mEntity.length > 0)
{
$(".mapWidget").hide();
apiurl = "http://services.phila.gov/ULRS311/Data/LIAddressKey/" + encodeURIComponent(mEntity);
LIMapHistoryServiceCall(apiurl, historySearch, null);
}
else if ($("#addressHistorySearchTxt").val().replace(/^\s+|\s+$/g, "").length > 0)
var request = require('bluebird'),
bhttp = require('bhttp'),
cheerio = require('cheerio'),
fs = require('fs'),
formData = [];
bhttp.get("http://services.phila.gov/", {}, function(err, response) {
if (err) {
return console.error('ERROR! This is what went wrong:', err);
}
@RubyRonin
RubyRonin / scapetest.js
Created October 12, 2015 19:58
Throwing error
var request = require('bluebird'),
bhttp = require('bhttp'),
cheerio = require('cheerio'),
fs = require('fs'),
formData = [];
bhttp.get("http://services.phila.gov/", {}, function(err, response) {
if (err) {
return console.error('ERROR! This is what went wrong:', err);
}
var request = require('bluebird'),
bhttp = require('bhttp'),
cheerio = require('cheerio'),
fs = require('fs'),
formData = [];
bhttp.get("http://services.phila.gov/", {}, function(err, response) {
if (err) {
return console.error('ERROR! This is what went wrong:', err);
}
function LoadDetails() {
mEntity = GetParameterByName('addressforhistory');
var apiurl = "";
if (mEntity.length > 0)
{
$(".mapWidget").hide();
apiurl = "http://services.phila.gov/ULRS311/Data/LIAddressKey/" + encodeURIComponent(mEntity);
LIMapHistoryServiceCall(apiurl, historySearch, null);
}
@RubyRonin
RubyRonin / gist:08cd20380c0b5086eee0
Created October 1, 2015 15:41
how do I use apply() to update scope see line 26 isn't working
.controller('DashBoardCtrl', function($scope, $cordovaContacts) {
$scope.user = {};
Parse.User.current().fetch().then(function (user) {
$scope.user.username = user.get('username');
$scope.user.email = user.get('email');
$scope.user.fname = user.get('firstName');
$scope.user.lname = user.get('lName');
$scope.user.draftpick = user.get('draftpick');
});
@RubyRonin
RubyRonin / gist:f5adaaf6e89b45ff1f2b
Created October 1, 2015 05:38
$scope.apply() isn't updating $scope.user
.controller('DashBoardCtrl', function($scope, $cordovaContacts) {
$scope.user = {};
Parse.User.current().fetch().then(function (user) {
$scope.user.username = user.get('username');
$scope.user.email = user.get('email');
$scope.user.fname = user.get('firstName');
$scope.user.lname = user.get('lName');
$scope.user.draftpick = user.get('draftpick');
});
$scope.contactgrab = function () {
$cordovaContacts.pickContact().then(function (contactPicked) {
$scope.contact = contactPicked;
// Parse.User.current().then(function() {
Parse.User.current().set('draftpick', $scope.contact.displayName);
// });
Parse.User.current().save(null,{
success: function(){
$scope.$apply(); // not yet tested
alert("added");
.controller('LoginCtrl', function($scope, $state) {
$scope.data = {};
$scope.signupEmail = function(){
//Create a new user on Pasre
var user = new Parse.User();
user.set("username", $scope.data.username);
user.set("password", $scope.data.password);
user.set("email", $scope.data.email);