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
import java.util.*; | |
import java.io.*; | |
public class Project { | |
public static void main(String[] args) { | |
// define the input for the user | |
Scanner userInput = new Scanner(System.in); | |
// the path to the file you want to load. This will have to change on your computer | |
String path = "/home/alex/code/java_examples/csv.txt"; | |
// use that path to read the file at that path name. See the readFile method |
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 strict'; | |
angular.module('app') | |
.controller('CreateWorkflowCtrl', function($scope, $location, Workflow, Category) { | |
$scope.workflow = new Workflow(); | |
$scope.page = 0; | |
$scope.create = function() { | |
$scope.workflow.$save(function(data) { | |
$location.path("/workflow/" + data.id); |
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
Template.imageboard.helpers({ | |
posts: function() { | |
return Posts.find({}, { sort: { timestamp: -1} }); | |
}, | |
has_posts: function() { | |
return Posts.find({}).count() > 0; | |
} | |
}); | |
Template.write.events({ |
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
// browser | |
> Meteor.users.findOne() | |
{ | |
_id: "1234" | |
} | |
// console | |
> Meteor.users.findOne() | |
{ | |
_id: "1234", |
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
/** | |
* Helpers applying to EVERY mongo collection in my db | |
*/ | |
Mongo.Collection.prototype._utilities = function() { | |
var self = this; | |
/** | |
* return all the ids of the items in this collection | |
* @returns {Array} all the ids in this collection | |
*/ |
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
ChildController = ParentController.extend({ | |
showItem: function () { | |
/** | |
* Here is the problem. | |
* I want to implicitly pass the "group" to EVERY rendered route | |
* Is it possible to do this? | |
*/ | |
var group = ChildController.__super__.data.call(); | |
this.render('itemPage', { | |
data: { |
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
{ | |
// type as in the primitive type of the data | |
type: Match.Any, | |
// label on the form | |
label: Match.Optional(Match.OneOf(String, Function)), | |
// is it required to be submitted or not | |
optional: Match.Optional(Match.OneOf(Boolean, Function)), | |
// these four are self-explanatory. | |
min: Match.Optional(Match.OneOf(Number, Date, Function)), | |
max: Match.Optional(Match.OneOf(Number, Date, Function)), |
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
Games = new Mongo.Collection("games"); | |
if (Meteor.isClient) { | |
Template.leaderboard.helpers({ | |
/** | |
* For user 'corvid', this should return both 'starcraft' and 'warcraft' | |
* because he is a player in the Roles.GLOBAL_GROUP | |
*/ | |
games: function () { | |
return Games.find({ |
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
// my data structure | |
[{ | |
forkedFrom: "1234", | |
days: [ 0, 1, 2, 3, 4, 5, 6 ], | |
timesOfDay: [ 0, 1 ] | |
}, { | |
forkedFrom: "5678", | |
days: [ 0, 1, 2, 3, 4, 5, 6 ], | |
timesOfDay: [ 0 ] | |
}] |
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
/** | |
* After an order is updated, add that data to the feed | |
*/ | |
Orders.after.update(function (userId, doc, modifier) { | |
// this is tedious | |
var user = Meteor.users.findOne(doc.userId); | |
// for payment status | |
if (_.has(modifier, ['$set', 'payment.status'])) { | |
var status = modifier.$set['payment.status']; |