Skip to content

Instantly share code, notes, and snippets.

View jeremyjs's full-sized avatar

Jeremy Meyer jeremyjs

  • San Francisco, CA
View GitHub Profile
# Developers are a tricksey bunch. Name some reasons why you shouldn't just trust the person who wrote the code.
# Name some mental pitfalls that you should watch out for when testing code.
# So then, why shouldn't we be satisfied with testing our own code?
When writing code, it is often hard to see the code from an unbiased perspective.
I can't know exactly what another person who is seeing this code for the first
time will think, or if they will be able to understand it. And I can't think of
everything that might go wrong either. I just spent time making it work a certian
way and have pidgeonholed myself into a certain way of thinking. It's much easier
to get some fresh eyes on the code than it is for me to try to make up for my own
class Thing
def initialize
@phase = 1
@values = [7, 11]
@other_values = [2, 3, 12]
end
def do_it
going = true
while going

CONSTANT_NAME variable_name ClassName functionName

  1. Naming things is cheap--have DESCRIPTIVE NAMES. It should read as close to natural language as possible, avoiding abbrevs. and in-house language when possible.

  2. Functions should have one thing they do. Endeavor to have pure functions, so that they do not have side effects. Functions should be have a maximum of three arguments. Good functions have one or two.

  3. Avoid being clever and implicit whenever possible.

Verifying that +jjman505 is my Bitcoin username. You can send me #bitcoin here: https://onename.io/jjman505
/**
* meyer88
* $SRCFILE
*/
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
@jeremyjs
jeremyjs / cucumber logs
Last active August 29, 2015 14:21
xolvio/meteor-cucumber/issues/114
Spawn script arguments:
parentPid: 27797
taskName: cucumber
command: meteor
commandArguments: [ 'run',
'--test-app',
'--port',
'47281',
'--include-tests',
'cucumber/fixtures',
if(urls[i][0]=='/' && urls[i][1]=='/' ) {
char* u1 = urls[i];
u1 += 2;
while(u1[0] != '/') {
u1++;
}
strcat(url2,u1);
}
else if(!urls[i][0]=='/') {
strcat(url2,"/");
@jeremyjs
jeremyjs / publish-counts-issue-35.js
Last active August 29, 2015 14:27 — forked from boxofrox/publish-counts-issue-35.js
Reactive publish-counts with computation example
// Don't leak observes in Meteor.publish callback.
// Define only one instance for server of buyer and distributor ids for reactive counts.
var BuyerQueue = new Meteor.Collection(null);
var DistributorQueue = new Meteor.Collection(null);
function isBuyer (doc) {
return _.include(doc.roles, 'buyer');
}
```
accounts-base 1.2.0 A user account system
accounts-password 1.1.1 Password support for accounts
accounts-ui 1.1.5 Simple templates to add login widgets to an app
alanning:roles 1.2.13 Role-based authorization
aldeed:autoform 5.4.1 Easily create forms with automatic insert and update, and automatic reactive validation.
aldeed:simple-schema 1.1.0* A simple schema validation object with reactivity. Used by collection2 and autoform.
anti:i18n 0.4.3 Internalization: simplest package
cfs:filesystem 0.1.2 Filesystem storage adapter for CollectionFS
cfs:s3 0.1.3 Amazon Web Services S3 storage adapter for CollectionFS
Iddocs = new Meteor.Collection ('iddocs');
Iddocs.attachBehaviour('softRemovable');
Iddocs.helpers({
update: function (modifier) {
return Meteor.call('updateDoc', this._id, modifier);
},
approve: function () {