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 / jasmine-async-await.md
Last active April 20, 2021 01:39
Jasmine with Async/Await

Background

Jasmine has Asynchronous Support which uses "function + done" formular. This spec will not start until the done function is called in the call to beforeEach. And this spec will not complete until its done is called.

beforeEach(function(done) {
  setTimeout(function() {
    value = 0;
    done();
  }, 1);
@iissnan
iissnan / tail.ps1
Last active December 13, 2020 11:39
Unix tail equivalent command in Windows Powershell
Get-Content ./log.log -Wait -Tail 10
@iissnan
iissnan / posts-controller.rb
Created April 7, 2017 05:40
#Rails - Insert attributes into Request Params
class PostsController < ApplicationController
def create
Post.create!(post_params)
end
private
def post_params
params.require(post).permit(:some_attrs).merge(user_id: current_user.id)
@iissnan
iissnan / hexo-helper-categories-state.js
Created March 3, 2017 09:07
Categories State Helper for Hexo
/* global hexo */
/**
* options {Object}
* options.url {Function} hexo url_for
* options.label {String} label
*/
hexo.extend.helper.register('categories_state', function(options){
var pages = hexo.locals.get('pages');
var categories = hexo.locals.get('categories');
@iissnan
iissnan / index.js
Last active September 23, 2016 11:34
SW Sass Processor
var fs = require('fs'),
os = require('os'),
path = require('path'),
Hapi = require('hapi'),
Promise = require('promise'),
lib = require('./lib.js'),
sassProcessor = require('./sass_processor.js'),
pseudoProcessor = require('./pseudo_processor') ;
@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 () {
@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 / 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');
# 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 / 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