Skip to content

Instantly share code, notes, and snippets.

View iissnan's full-sized avatar
💭
I may be slow to respond.

Vi iissnan

💭
I may be slow to respond.
View GitHub Profile
@iissnan
iissnan / karma.conf.js
Created February 13, 2015 08:08
Karma testing configuration.
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
'../common/assets/vendor/jquery/dist/jquery.min.js',
'../common/assets/vendor/angular/angular.min.js',
'../common/assets/vendor/angular-mocks/angular-mocks.js',
'../common/assets/vendor/lodash/lodash.min.js',
@iissnan
iissnan / import-if.js
Created March 20, 2015 02:50
Stylus plugin (draft)
/**
* Stylus Plugin
*
* `import-if` - Import files if they exist.
*/
var path = require('path');
var fs = require('fs');
module.exports = function () {
Listen 8000
<VirtualHost *:8000>
DocumentRoot "x:\laoshi"
ErrorLog "logs/laoshi-error.log"
CustomLog "logs/laoshi-access.log" common
<Directory "x:\laoshi">
AllowOverride All
Require all granted
</Directory>
@iissnan
iissnan / README.md
Created March 21, 2016 02:01 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@iissnan
iissnan / content-script.js
Created April 27, 2016 07:55
Extension that Injects scripts into pages on Google Chrome
'use strict';
var s = document.createElement('script');
s.src = chrome.extension.getURL('injection.js');
s.onload = function() {
this.parentNode.removeChild(this);
};
(document.head || document.documentElement).appendChild(s);
@iissnan
iissnan / open-google-chrome.bat
Last active April 27, 2016 08:43
Start Google Chrome in incognito mode with DevTools open automatically on Windows
REM Close any existing Google Chrome instatnce first.
"C:\Users\{user.name}\AppData\Local\Google\Chrome\Application\chrome.exe" --auto-open-devtools-for-tabs --incognito URL
# Script Vendors.
# Set a CDN address for the vendor you want to customize.
# For example
# jquery: https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
# Be aware that you should use the same version as internal ones to avoid potential problems.
vendors:
# Internal path prefix. Please do not edit it.
_internal: vendors
# Internal version: 2.1.3
@iissnan
iissnan / index.js
Created September 21, 2016 07:03
Simple Hapi Reverse Proxy
const server = require('./server');
server.connection({ host: '0.0.0.0', port: 80 });
server.register({
register: require('h2o2')
}).then(function (err) {
if (err) throw err;
require('./routes');
@iissnan
iissnan / index.js
Created September 21, 2016 08:05
DPW HTML Pages Pre-process
'use strict';
const Promise = require('bluebird');
const _ = require('lodash');
const path = require('path');
const fs = require('../lib/fs');
const server = require('../server');
const config = require('../config');
server.route({
@iissnan
iissnan / grunt.js
Created September 23, 2016 09:32
DPW Grunt Processor
const path = require('path');
const os = require('os');
const cp = require('child_process');
const spawn = require('cross-spawn');
const Promise = require('bluebird');
const buildDir = path.resolve(__dirname, '../../build/script');
module.exports = {
run: function () {