Re-using custom npm modules

Published On: Saturday, October 6th 2018
From time to time, there will be a need to include a customized node module across multiple projects. This may be because the original has a bug and you know how to fix it, or simply creating a new re-usable module. Luckily, there's an easy way to do this using github. If you're new to github, I'd suggest reading up on it before proceeding.

Step 1: Push your module to github

Prepare your module, as usual. Instead of sending it to npm, just push it up to a new github repo. If you're working on fixing or updating a module that already exists, you can just fork the module's github repo and work in your fork!

Step 2: Installing from github

This is really easy:
npm install --save username/repo
Here's a real example:
npm install --save barrygilbert/mysql-restapi
You can also reference a specific branch:
npm install --save barrygilbert/mysql-restapi#master

Step 3: Do your thing!

Now that you can install that module into multiple projects, go code it up!

Facebook Cover Photos

Published On: Wednesday, October 24th 2012
Personalizing your Facebook Cover Photo is easy, once you know how to search for one. Here's a quick guide to help you find exactly what you want:
  1. Go to Google Image Search
  2. Search for something, for instance: Fringe
  3. On the left, click 'Exactly...' under Any Size
  4. Enter a width of 851
  5. Enter a height of 316
  6. Now all the images in your results are the perfect size for your Facebook Cover.
  7. Keep on searching to find something uniquely you!
Now, if there's a watermark/logo, you can remove it in Gimp or Photoshop. Or you can just pick an image without a mark in it. Happy Facebook-Stalking! j/k lol

Are Games Moving to Legal Torrents?

Published On: Tuesday, January 26th 2010
Thursday, 1/21/2010, someone uploaded Mass Effects 2 to a torrent site. Between then and today, it has bounded to the top of The Pirate Bay's PC Games category and #4 in the overall top 100. Today, the official game release date, the 14.35GB download has 1,877 seeders and 28,448 leechers according to TPB. The retail version of this game comes with access to downloadable content. While this additional content can be purchased for $15 if the game comes second hand, that doesn't help those that download the game illegally. The retail PC version can be found for at little as $43. My theory is simple: This game was leaked by BioWare. They want to see how many people buy the game vs how many download it, when buying the game comes with extra content. The leak is just like an old school demo; the ones where you got the whole game, but just one level. The business model makes perfect sense. The more people that download via BitTorrent, the more money saved from manufacturing. On top of that, removing retailers from the financial pyramid makes products cheaper for the consumer and more revenue directly to the producer. Could we be returning to these earlier days? Could this be the future? Game makers releasing a low content version via BitTorrent and charging for additional content?

Cafe World Cheat #2

Published On: Sunday, January 17th 2010
UPDATE 3/18/2010: I have created some tools to help at http://www.cafeworldhelper.com. Included are a cooking suggestion tool, more cheats and tricks, a forum, even a spice tool. I've got another cheat for all you cafe world fans. If you turn your stove toward a wall or table or another stove, you will not have to walk to the stove. Ever. In fact, the only place your character will walk to is a serving table. Bonus Tip Max your buzz rating to 105.0 by making sure no customer leaves without food. Following my original Cafe World post, will almost ensure this. Once your employees are boxed in, if anyone leaves without food, (re)move the table/chair where that person was sitting.

HTML Post #7: CSS & Browsers

Published On: Monday, December 14th 2009
In closing up the HTML series, we're gonna cover stylesheets and differences between browsers. Stylesheets This is just a text document that holds all your style information. It is stored in a separate file so the webpages are smaller and keep traffic down on the webserver and the internet. To set the style of all p tags, you would say:
p {
    color: green;
    text-align: center;
    background: red;
}
That would make everything inside a p tag green, centered, and have a red background. You could do the same with a div tag, table tag, img tag, or any other tag. You can also use a class name:
.christmas {
    color: green;
    text-align: center;
    background: red;
}
Any tag that has class="christmas" would have those styles. You can combine the two:
p.christmas {
    color: green;
    text-align: center;
    background: red;
}
Now, any p tag that has class="christmas" will have the style. The "p.christmas" in that last example is called the selector. There are plenty more types of selectors, including "ancestor descendant" and "parent > child". Here is more information about selectors and style properties. Linking Putting this in the head section will link the page with a stylesheet at http://www.example.com/style.css:
<link rel="stylesheet" href="http://www.example.com/style.css" type="text/css" />
You can even set a print css, only used when printing the page:
<link rel="stylesheet" href="http://www.example.com/print.css" type="text/css"
 media="print" />
A document can have multiple stylesheets. The second one will supercede the first if there's any duplication. There is one exception. If the first file says this:
p.error {
    color: red !important;
}
Then the second file will have to use "!important" if it is to supercede the color. Browser Differences From time to time, you'll run across something that looks fine in one browser and totally funky in another. If you run into this, do a quick search or two. Odds are that someone else has run into it too. Many times, the answer will be an IE conditional statement or some sort of CSS Hack. The IE conditional works like this:
<!--[if IE]>
<p>According to the conditional comment this is Internet Explorer</p>
<![endif]-->
It's really one big html comment! IE will show it. Firefox and the rest will ignore it. You can even say:
<link rel="stylesheet" href="http://example.com/overall.css" type="text/css" />
<!--[if IE 6]>
<link rel="stylesheet" href="http://example.com/ie6.css" type="text/css" />
<![endif]-->
That will tell only IE 6 to use an additional stylesheet.
<link rel="stylesheet" href="http://example.com/ie.css" type="text/css" />Linking

Tag Cloud

Copyright © 2025 Barry Gilbert.