Skip to content

Instantly share code, notes, and snippets.

View TJkrusinski's full-sized avatar

TJ Krusinski TJkrusinski

  • Facebook
  • Menlo Park, CA
View GitHub Profile
@TJkrusinski
TJkrusinski / Node.js-Ubuntu.sh
Last active December 15, 2015 00:08
Deploy node and redis on ubuntu.
#!/bin/sh
# Update System
echo 'System Update'
apt-get -y update
echo 'Update completed'
# Install help app
apt-get -y install libssl-dev pkg-config build-essential git curl gcc g++ checkinstall
@TJkrusinski
TJkrusinski / zmq.sh
Last active December 16, 2015 06:28
zmq install ubuntu @3.2.2
#!/bin/bash
echo 'Installing ZMQ'
curl http://download.zeromq.org/zeromq-3.2.2.tar.gz > z.tar.gz
tar -xvzf z.tar.gz
cd zeromq-3.2.2
apt-get -y install libtool autoconf automake uuid-dev
@TJkrusinski
TJkrusinski / client.js
Last active November 24, 2016 23:22
Twitter Love/Hate for stack overflow.
$(function(){
var socket = io.connect('http://localhost:8080');
socket.on('tweet', function(tweet) {
$('body').append('<div class="tweet">' + tweet.text + '</div>');
});
});
@TJkrusinski
TJkrusinski / checktype.js
Created May 17, 2013 15:59
Type checker for JS that actually works.
/**
* Taken from http://james.padolsey.com/javascript/checking-types-in-javascript/
*/
function type(o){
return !!o && Object.prototype.toString.call(o).match(/(\w+)\]/)[1];
}
type(101); // returns 'Number'
@TJkrusinski
TJkrusinski / haproxy-ssl.cfg
Last active June 19, 2018 10:10
HAProxy SSL Setup Redirect non HTTPS traffic to HTTPS and terminate SSL
# Basic file, has no logging or anything else setup
global
maxconn 20000
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
@TJkrusinski
TJkrusinski / syntax.md
Created February 10, 2014 17:50
Syntax highlighting in keynote made easy

Keynote I guess pushed an update that doesn't take hightlighted code from xCode anymore. So, I googled around and found hightlight. It is a super useful utitlity to do syntax highlighting from the command line.

$ brew install hightlight

If you are on Mavericks you may need to brew link lua to get it working right.

Hightlight has support for all kinds of languages and themes and it can wrap the code with line numbers, which is great.

// make andrew a gist of a Gruntfile with watch and express
module.exports = function(grunt){
grunt.initConfig({
concurrent: {
dev: ['watch:sass', 'watch:browserify'],
},
watch: {
var NodePDF = require('nodepdf');
// last argument is optional, sets the width and height for the viewport to render the pdf from. (see additional options)
var pdf = new NodePDF('http://www.yahoo.com', 'yahoo.pdf', {
'viewportSize': {
'width': 1440,
'height': 900
},
'args': '--debug=true'
});