Skip to content

Instantly share code, notes, and snippets.

View maggocnx's full-sized avatar

Marco Grieb maggocnx

  • Gronic Systems
  • Birstein, Germany
View GitHub Profile
@maggocnx
maggocnx / index.html
Last active August 29, 2015 14:13
Gronic Systems App Demo
<!DOCTYPE html>
<html ng-app="demoApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<script src="../gronic-ui/js/gronic-bundle.js"></script>
<link rel="stylesheet" href="../gronic-ui/css/gronic.css">
</head>
<body ng-controller="DemoCtrl" ng-keydown="onKeypress($event)">
@maggocnx
maggocnx / print-order.js
Last active August 29, 2015 14:07
Print
isNodeWebkit = (typeof process !== "undefined") ;
$("body").append('<canvas id="printCanvas" width="384" height="'+ canvasHeight + '"></canvas>');
var canvas = document.getElementById('printCanvas');
this.drawCanvas(canvas,order, function(){
if(isNodeWebkit){
fs = require("fs");
var exec = require("child_process").exec;
var __dirname = process.cwd();
@maggocnx
maggocnx / lcd.js
Last active August 29, 2015 14:07
Customer Lcd
isNodeWebkit = (typeof process !== "undefined") ;
$("body").append('<canvas id="lcdCanvas" width="128" height="64"></canvas>');
var canvas = document.getElementById('lcdCanvas');
this.drawCanvas(canvas, function(){
if(isNodeWebkit){
fs = require("fs");
var exec = require("child_process").exec;
var __dirname = process.cwd();
$scope.$on('$viewContentLoaded', function() {
$scope._style = document.createElement('link');
$scope._style.type = 'text/css';
$scope._style.href = 'application/Invoice/Resource/single.css';
$scope._style.rel = 'stylesheet';
$scope._style = document.head.appendChild($scope._style);
});
$scope.$on('$destroy', function() {
@maggocnx
maggocnx / index.js
Created June 26, 2014 08:18
Minimal Express Server
var http = require('http');
var tessel = require('tessel');
var led1 = tessel.led[0];
var led2 = tessel.led[1];
setTimeout(function start () {
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
led1.toggle();
led2.toggle();
@maggocnx
maggocnx / CeSmLm.c
Created January 22, 2014 15:48
Printer Problem
DWORD GetPrinterStatus(unsigned char* bufferRecv,const DWORD dwSize,DWORD* dwRead)
{
DWORD dwErr = SUCCESS;
//send DLE EOT request
//THIS IS WORKING
dwErr = WriteDeviceIf0((unsigned char*)"\x10\x04\x14", 3);
// return an error in write function
@maggocnx
maggocnx / index.js
Created January 12, 2014 07:42
Add debug info to console.log
function getErrorObject(){
try {
throw Error('')
}
catch(err) {
return err;
}
}
@maggocnx
maggocnx / app.js
Created January 10, 2014 13:55
Basic express js setup
var express = require('express.io');
var http = require('http');
var path = require('path');
var MongoStore = require('connect-mongo')(express);
var routes = require('./routes');
var app = express().http().io();
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
@maggocnx
maggocnx / app.js
Created December 17, 2013 10:16
Dyndns Replacement
var express = require('express');
var app = express();
var dynAddress = null;
var dynPort = "";
app.get("/reg", function(req,res){
if(req.query.port)
dynPort = req.query.port;
@maggocnx
maggocnx / wait.sh
Created November 28, 2013 15:47
Waiting for server going online
#! /bin/bash
wait=true
while $wait
do
sleep 1
ready=$(curl -sL -w "%{http_code}\\n" $1 -o /dev/null)
if [ $ready -eq 200 ]
then
wait=false
fi