View store-main.js
import { ipcMain, BrowserWindow } from 'electron'
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const state = {
count: 0
}
View future_and_promise.js
class F extends Promise {
onComplete(callback) {
this.then(callback, callback);
}
}
class P {
constructor() {
this.future = new F((resolve, reject) => {
this.trySuccess = resolve;
View error_matcher.rb
module Rescuer
class << self
attr_accessor :error_class
def error_matcher
error_class = self.error_class
Module.new do
define_singleton_method :=== do |e|
error_class === e
View gacha.rb
ITEMS_BASIC = [
[:R, 82],
[:SR, 15],
[:SSR, 3],
]
ITEMS_SPECIAL = [
[:SR, 97],
[:SSR, 3],
]
View errors_with_symbol.rb
require 'active_model'
class ActiveModel::Errors
module WithSymbol
attr_accessor :symbol_value
end
def add_with_symbol(attribute, message = :invalid, options = {})
add_without_symbol(attribute, message, options).tap do |messages|
View lovelive_quiz.rb
#!/usr/bin/env ruby
require "json"
require "open-uri"
class LoveLiveQuiz
API_URL = 'https://lovelive-quiz-api.herokuapp.com/quiz'
def initialize
fetch
View active_model_each_error_to_be_formattable.rb
require 'active_model'
class ActiveModel::Errors
module HiddenEntity
attr_accessor :_entity
end
def generate_message_with_format(attribute, type = :invalid, options = {})
message = generate_message_without_format attribute, type, options
View mix.coffee
Array::forEachAsync = (each, context) ->
copy = @slice()
index = -1
do next = ->
return if copy.length == 0
process.nextTick ->
item = copy.shift()
index += 1
View e.rb
class Parent
enumerize :nyan, in: [:a, :b, :c], scope: true
end
class Child1 < Parent
enumerize :nyan, in: [:a], default: :a
end
class Child2 < Parent
enumerize :nyan, in: [:a, :b], default: :b
View proxy.js
#!/usr/bin/env node
var fs = require('fs')
, http_proxy = require('http-proxy')
, http = require('http')
, https = require('https')
, cert_file_path = '/path/to/server.crt'
, key_file_path = '/path/to/server.key';
var proxy = http_proxy.createProxyServer();