Skip to content

Instantly share code, notes, and snippets.

var config = {
addVendor: function(name, path, loaders) {
this.resolve.alias[name] = path;
if (loaders) {
this.module.loaders.push({test: new RegExp(path), loaders: loaders});
}
}
...
};
@mashiro
mashiro / miniparse.css
Last active August 29, 2015 14:19
More editable miniparse.html
* {
font-family: "Meiryo";
font-size: 12px;
font-weight: normal;
box-sizing: border-box;
}
html {
height: 100%;
overflow: hidden;
require 'uri'
require 'addressable/uri'
module URI
class << self
def parse(*args)
Addressable::URI.parse *args
end
def escape(*args)
@mashiro
mashiro / log_subscriber.rb
Last active August 29, 2015 14:10
Rails のログを構造化するやつ
module MyApp
class LogSubscriber < ActiveSupport::LogSubscriber
INTERNAL_PARAMS = %w(controller action format _method only_path)
IGNORE_PAYLOAD_NAMES = ["SCHEMA", "EXPLAIN"]
class << self
attr_accessor :logger
end
def registry
app = angular.module 'app', []
app.directive 'collapse', ->
restrict: 'A'
scope:
isOpen: '=?'
onToggle: '&'
controller: ($scope) ->
$scope.open = =>
$scope.$evalAsync =>
require 'json'
class Schema
attr_reader :items
def initialize(&block)
@items = []
instance_eval &block
end
mashiro@ricotta ~% curl -v -I -A "MSIE 10" 'http://t.co/vLSMNCVVZq' 2> /dev/null | grep location
mashiro@ricotta ~% curl -v -I -A "MS1E 10" 'http://t.co/vLSMNCVVZq' 2> /dev/null | grep location
location: http://twitter.com/aya_uchida/status/498859889976832000/photo/1
mashiro@ricotta ~%
# coding: utf-8
require 'nokogiri'
require 'kconv'
class URL
include Donkun::Plugin
set :help, <<-EOS
URL の情報を表示します
EOS
def nested_resources(*args, &block)
scope only: [:index, :create] do
resources *args, &block
end
end
def shallow_resources(*args, &block)
scope only: [:show, :update, :destroy] do
resources *args, &block
end
function vi-quit() { exit }
zle -N q vi-quit