Skip to content

Instantly share code, notes, and snippets.

View chrisdel101's full-sized avatar

Chris Del chrisdel101

  • University of Regina
View GitHub Profile
@chrisdel101
chrisdel101 / fix-homebrew-npm.md
Created September 7, 2016 04:20 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

function countPositivesSumNegatives(input) {
if (input == null){
return []
} else if (input == []){
return Array.lenght === 0
} else {
var blankArray = [];
var posCount = 0;
var negSum = 0;
for (var i = 0;i < input.length;i++){
import React, { Component } from 'react';
import Dropzone from 'react-dropzone';
import './App.css';
import AvatarEditor from 'react-avatar-editor'
class MyEditor extends React.Component {
render () {
return (
<AvatarEditor
<div className="history">{this.state.history.map((item,index) => {index
IF (CURRENT ITEM IS === LAST ITEM) THEN DON'T PRINT CURRENT ITEM
return (
<div key={index} onClick={this.goBackHistory.bind(this,index)}>
{item.title}
</div>
)
})
import React, { Component } from 'react';
import Dropzone from 'react-dropzone';
import AvatarEditor from 'react-avatar-editor'
class MyEditor extends React.Component {
constructor(props){
super(props);
//set all properties to variable initialValues
let initialValues = {
//src/index.js
import React from 'react'
import ReactDOM from 'react-dom'
ReactDOM.render(
<h2>Hello React with JSX</h2>,
document.getElementById('root');
);
MONGO DATA (doglist)
{ "_id" : ObjectId("58dc7505cefb0da47eab5205"), "name" : "buddy", "breed" : "white lab", "description" : "loves to play ball" }
INDEX.JS
var express = require('express');
var router = express.Router();
var mongo = require('mongodb')
@chrisdel101
chrisdel101 / gist:a48b30b4b3d68f70b4a1f191f2c6f421
Last active April 6, 2017 16:16
Mongoose Tutorial - Problem- books not defined
Hitting books route gives back ReferenceError: Book is not defined
App.js
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
router.post("/", (req,res) => {
req.checkBody('name', 'Cannot be empty').notEmpty()
var entry = {
name:req.body.username,
email: req.body.email
}
Email.find({"email":entry.email}, (err, email) => {
console.log(email)
cat: GNU: No such file or directory
cat: nano: No such file or directory
cat: 2.7.4: No such file or directory
cat: 'File:': No such file or directory
Uninstalling modules from DKMS
Attempting to install using DKMS
Creating symlink /var/lib/dkms/vboxguest/5.0.24/source ->
/usr/src/vboxguest-5.0.24