Skip to content

Instantly share code, notes, and snippets.

@purgna
purgna / code-smell.md
Last active August 29, 2015 14:19 — forked from gvn/code-smell.md

Eliminating Code Smell With Grunt

by Gavin Lazar Suntop @gvn

Intro

I love clean code. There, I said it. I pride myself on passing strict linting standards and keeping my code easy to read. It's not just a personal proclivity, but a choice I hope benefits other developers.

My general experience with teams has been that code style is something people care about and have strong personal preferences. Typically, at some point people get tired of dealing with inconsistency and a standardization meeting is called. This is, of course, an important discussion to have. The problem that tends to occur is either lack of documentation or lack of enforcement of the agreed upon style. Additionally, new team members or contributors may not have access to a clear set of rules.

@purgna
purgna / index.js
Last active August 29, 2015 14:19
var express = require('express')
, gracefulExit = require('express-graceful-exit')
, domainError = require('express-domain-errors')
, domain = require('domain')
, serverDomain = domain.create()
, app
, server
function sendOfflineMessage() {
if (process.send) process.send('offline')
package org.springframework.boot.context.embedded.jetty;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.IPAccessHandler;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
// Bring Mongoose into the app
var mongoose = require( 'mongoose' );
// Build the connection string
var dbURI = 'mongodb://localhost/mongoose-best-practices';
// Create the database connection
mongoose.connect(dbURI);
// CONNECTION EVENTS
@purgna
purgna / App.java
Last active August 29, 2015 14:24 — forked from thomasdarimont/App.java
package demo;
import static java.lang.reflect.Modifier.*;
import java.util.Arrays;
import java.util.Set;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanExpressionResolver;
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@purgna
purgna / jdk_download.sh
Last active August 29, 2015 14:25 — forked from P7h/jdk_download.sh
Commands / shell script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt.
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@purgna
purgna / gist:9a450d95ac5da8cb1678
Last active August 29, 2015 14:26 — forked from timf/gist:4040915
vagrant ramdisk (Linux)
cd /home/tim/VirtualBox\ VMs/
mv proxydev2_1351794515 tmp
mkdir proxydev2_1351794515
sudo mount -t tmpfs -o size=10G tmpfs /home/tim/VirtualBox\ VMs/proxydev2_1351794515
cp -a tmp/* proxydev2_1351794515/
# go back to vagrant directory and `vagrant up`
@purgna
purgna / gist:eb685be79596461fd617
Last active September 1, 2015 05:28 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

@purgna
purgna / kb-uninstall.bat
Last active September 1, 2015 05:29 — forked from Citillara/kb-uninstall.bat
Windows updates to remove
:: Removes most telemetry/data collection/potentially unwanted behavior from Windows 7
:: Note : be careful to keep KB in descending order
:: Removes Windows 7-8.1 telemetry (part 1)
wusa /uninstall /kb:3080149
wusa /uninstall /kb:3075249
wusa /uninstall /kb:3068708
:: Removes the "Get Windows 10" (GWX)
wusa /uninstall /kb:3035583
:: Removes Windows 7-8.1 telemetry (part 2)