Skip to content

Instantly share code, notes, and snippets.

View sbruchmann's full-sized avatar

Steffen Bruchmann sbruchmann

View GitHub Profile
@sbruchmann
sbruchmann / README.md
Last active December 15, 2015 23:29
node-webkit and Angular.js

Running a standalone app with node-webkit and Angular.js

After you have downloaded and installed node-webkit, create a directory on your hard-drive named myapp.

Place all files of this gist inside the created directory:

  • myapp/
    • app.js
  • index.html
@sbruchmann
sbruchmann / server.js
Created September 9, 2013 09:46
Process GET request via Node.js
"use strict";
// Module Dependencies & Initializations
var createServer = require("http").createServer;
var qs = require("querystring");
var server = createServer();
server.on("request", function onRequest(req, res) {
var params = qs.parse(req.url);
@sbruchmann
sbruchmann / flat-ui-color-palette.styl
Last active December 24, 2015 05:59
All colors from Flat UI as stylus variables
// See http://flatuicolors.com/
$alizarin = #e74c3c
$amethyst = #9b59b6
$asbestos = #7f8c8d
$belize-hole = #2980b9
$carrot = #e67e22
$clouds = #ecf0f1
$concrete = #95a5a6
$emerald = #2ecc71
$green-sea = #16a085
@sbruchmann
sbruchmann / filters.js
Created January 12, 2014 22:57
Chaining Angular.js filters
angular.module('phonecatFilters', [])
.filter('checkmark', function() {
return function(input) {
return input ? '\u2713' : '\u2718';
};
})
.filter('foobar', function() {
return function(input) {
return 'foobar';
};
/* Based on http://goldengridsystem.com */
.col {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
float: left;
padding-left: 0.75em;
padding-right: 0.75em;
}
@sbruchmann
sbruchmann / app.js
Created June 5, 2014 04:05
Feathers.js bug: Service#create gets called twice
'use strict';
var feathers = require('feathers');
var rubberduck = require('rubberduck');
var tasks = [];
var emitter = rubberduck.emitter(tasks).punch('push');
emitter.on('beforePush', function(args, instance) {
console.log(new Date(), 'About to push ' + args[0]);
@sbruchmann
sbruchmann / pubsub.js
Created June 12, 2014 18:25
Minimal PubSub solution
// Original code by David Walsh: http://davidwalsh.name/pubsub-javascript
var events = (function(){
var topics = {};
return {
subscribe: function(topic, listener) {
// Create the topic's object if not yet created
if(!topics[topic]) topics[topic] = { queue: [] };
// Add the listener to queue
@sbruchmann
sbruchmann / main.js
Created June 27, 2014 07:31
Hide Toolbar in Brackets
define(function () {
"use strict";
$("#main-toolbar").hide();
});
@sbruchmann
sbruchmann / main.js
Last active August 29, 2015 14:03
Writing files in Brackets extensions
define(function () {
"use strict";
var AppInit = brackets.getModule("utils/AppInit"),
FileSystem = brackets.getModule("filesystem/FileSystem"),
ProjectManager = brackets.getModule("project/ProjectManager");
AppInit.appReady(function () {
var filename = ProjectManager.getProjectRoot().fullPath + "hello-world.txt";
FileSystem.getFileForPath(filename).write("Hello world!\n");
@sbruchmann
sbruchmann / README.md
Last active August 29, 2015 14:03
Restart a node-webkit app