Skip to content

Instantly share code, notes, and snippets.

@MarcDiethelm
MarcDiethelm / appCache-dev-helper.js
Created August 31, 2012 16:22
AppCache Dev Helper
// when the page loads, set the status to online or offline
function loadDemo() {
if (navigator.onLine) {
appCacheLog("Initial online status: online");
return;
} else {
appCacheLog("Initial online status: offline");
return;
}
}
@MarcDiethelm
MarcDiethelm / lawg.js
Created September 11, 2012 20:32
Global development and debugging helper (browser)
/**
* Global development and debugging helper
* Author: Marc Diethelm
*/
(function() {
var w = window
,c
,concatArgs
/*
* Find all the divs with IDs that start with the "ceid_" prefix and add the "liveEditElement" class to them.
*/
(function() {
if (typeof window.jQuery == 'undefined') {
setTimeout(arguments.callee, 100);
} else {
$('div[id^="ceid_"]').addClass('liveEditElement');
}
})()
@MarcDiethelm
MarcDiethelm / terrific-js-pattern.md
Last active May 23, 2016 08:08
Ein sauberes Pattern für Terrific JS Module

Ein sauberes Pattern für Terrific JS Module

Terrific.js ist ein grossartiges Tool um Frontend Code zu strukturieren und füllt damit eine der grossen Lücken die jQuery offen lässt. Weil Terrific auf jQuery basiert und aufbaut übernimmt es auch eine der Eigenschaften von jQuery. Eine Eigenschaft, die robuste und lesbare objektorientierte Programmierung erschwert.

Das Problem

jQuery verwendet die Konvention, dass in den meisten Callbacks, Event Handlers zum Beispiel, der Kontext this ein DOM-Objekt ist. Das führt zur unangenehmen Situation dass in einem Terrific Modul die Bedeutung von this ständig wechseln kann:

on: function(callback) {

How to deploy Heroku-style on Digital Ocean with Dokku

Because a basic VPS at Digital Ocean costs $5 a month. And you can host as many apps as you want. An nginx serves as a proxy for your apps.


Update

Now you don't have to install Dokku yourself anymore. There's a pre-configured Dokku image available on Digital Ocean, that you can spin up with just a few clicks...

VM

@MarcDiethelm
MarcDiethelm / strongloop-heroku.md
Last active July 17, 2019 05:59
How to install a Node.js app using Strongloop on Heroku

How to install a Node.js app using Strongloop on Heroku

with different environments like staging and production no less! new: now with multiple account administration!

  1. Create a Node.js app as you would normally, managing your dependencies with npm in package.json.
  2. Your app should be set up to listen on process.env.STRONGLOOP_PORT || [your usual local port].
  3. Download and install the Heroku toolbelt. This install includes git.

➽ If you need to handle multiple accounts, install the accounts plugin.

@MarcDiethelm
MarcDiethelm / Contributing.md
Last active January 14, 2024 02:05
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.