Skip to content

Instantly share code, notes, and snippets.

View czbaker's full-sized avatar

Charles Baker czbaker

View GitHub Profile
@czbaker
czbaker / group-document.json
Created March 11, 2015 14:00
Search and Helper
{
"name" : "WASDnation",
"desc" : "We rock!",
"url" : "http://wasdnation.com",
"tags" : [
"wow",
" csgo",
" casual"
],
"ranks" : [
@czbaker
czbaker / quick-form.js
Created April 20, 2015 13:12
Form Handling
Template.quickForm.events({
// Submission of Category form
"submit #catForm": function(event) {
// Do some form verification here
var theName = event.target.catName.value;
var theLimit = event.target.catLimit.value;
// Thanks to: http://stackoverflow.com/questions/308122/simple-regular-expression-for-a-decimal-with-a-precision-of-2
@czbaker
czbaker / quick-form.html
Created April 20, 2015 13:20
Category Form Segment
<!-- Category -->
<form id="catForm">
<section class="form-group">
<label for="transAmount">Name:</label>
<input type="text" class="form-control input-sm" id="catName" placeholder="Category Name">
</section>
<section class="form-group">
<label for="transAmount">Budget (Optional):</label>
<section class="input-group">
<span class="input-group-addon input-sm">$</span>
@czbaker
czbaker / modfiles.js
Created June 4, 2015 21:56
collection is undefined? (Meteor error)
// Storage for mod uploads (.zip only)
var modStore = new FS.Store.S3("modFiles", {
accessKeyId: Meteor.settings.awsAccessKeyId,
secretAccessKey: Meteor.settings.awsSecretKey,
bucket: Meteor.settings.awsBucket,
folder: "mods"
});
ModFiles = new FS.Collection("modFiles", {
var urlBase = "stuff";
var names = ['blah', 'blah', 'blah', 'blah', 'blah'];
// This will add the URL to your names, making them proper Twitch URLs.
_.map(names, function(name) {
return urlBase + name;
});
// We need an empty array here to hold the data we're getting from Twitch.
var responses = [];
@czbaker
czbaker / message-list.js
Created June 17, 2015 16:13
jQuery onRendered not working.
// Rendered (jQuery stuff)
Template.msgList.onRendered(function() {
$(".message-block").mouseover(function() {
alert("Triggered!");
$(this).find(".message-delete").css("color", "#3E3F3A");
});
$(".message-block").mouseout(function() {
$(this).find(".message-delete").css("color", "#F8F5F0");
// Mod Follows
Follows = new Mongo.Collection("follows");
Follows.allow({
insert: function(userId, doc) {
return userId;
},
update: function(userId, doc) {
return false;
},
Template.layout.onCreated(function() {
var follows = Follows.find({owner: this.userId}, { fields: { uid: 1 }}).map(function(doc) {
return doc._id;
});
console.log(follows);
Events.find( { uid: { $in: follows } }).observe({
// Event Handler
Template.template.events({
'blur .order': function(event) {
var position = $(event.target).val();
Meteor.call('updateOrder', this, position, function(err) {
throw new Meteor.Error("Couldn't update record");
});
client = MPD.connect({
port: 6600,
host: 'localhost'
});
client.on('system-player', function() {
client.sendCommand(cmd('currentsong', []), function(err, msg) {
if (err) throw new Meteor.Error("dead", "He's dead, Jim!");
console.log(msg)
})