Skip to content

Instantly share code, notes, and snippets.

Avatar

Ruby Ronin RubyRonin

View GitHub Profile
View gist:fbd7e85d4216522368ac
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)
{
View example.js
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)
View error.js
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);
}
View scapetest.js
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);
}
View gist:847f3bfe2aa6769b75c0
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);
}
View gist:c26817fbe61744522a95
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 Oct 1, 2015
how do I use apply() to update scope see line 26 isn't working
View gist:08cd20380c0b5086eee0
.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 Oct 1, 2015
$scope.apply() isn't updating $scope.user
View gist:f5adaaf6e89b45ff1f2b
.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');
});
View gist:bf8e8f4baccf85c057d8
$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");
View entire controller
.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);