My initial motivation for -XDerivingVia was deriving across
isomorphisms.
Standard type-class encodings of isos turn out to be awkward due to overlap.
My initial motivation for -XDerivingVia was deriving across
isomorphisms.
Standard type-class encodings of isos turn out to be awkward due to overlap.
| import ReactDOM from 'react-dom'; | |
| import React, { Component } from 'react'; | |
| import { Provider, connect } from 'react-redux'; | |
| import { createStore, compose } from 'redux'; | |
| const todos = (state = [], action) => { | |
| switch (action.type) { | |
| case 'CREATE_TODO': | |
| return state.concat([action.text]) | |
| default: |
| #!/usr/bin/env ruby | |
| require 'mail' | |
| Mail.defaults do | |
| delivery_method :smtp, { :address => "email-smtp.us-east-1.amazonaws.com", | |
| :port => 587, | |
| :user_name => "YOUR_IAM_SMTP_USER_FOR_SES", | |
| :password => "YOUR_VERY_LONG_PASSWORD", | |
| :authentication => 'plain', |
| module DataService | |
| RELATION_ID = 'relation' | |
| module DataApi | |
| def self.included base | |
| base.singleton_class.send :attr_accessor, # private method | |
| :json_attributes, # 数据模型的json属性定义 | |
| :expire_time, # 数据模型的过期时间 | |
| :model_class, # 数据模型对应的Activerecord, 默认值是根据类名推断, 可以在这里覆盖 | |
| :cache_key # 缓存的key, 有默认值, 通常不需要设置 |
| require 'redis' | |
| Chars=('A'..'Z').to_a | |
| def g(prefix) | |
| choice = rand(9) | |
| if (choice == 0) | |
| # Values around this size stress the cascading update. | |
| len = [252,250].shuffle.first | |
| prefix += rand(1000000).to_s | |
| string = prefix + ("A"*(len-prefix.length)) |
| # More information available at https://www.owasp.org/index.php/Blind_SQL_Injection | |
| POSITIVE_DELAY = 2 | |
| CHARS = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a | |
| def query(table, field, id, char, pos) | |
| %Q[SELECT CASE WHEN substr(#{field}, #{pos}, 1) = \'#{char}\' THEN pg_sleep(#{POSITIVE_DELAY}) ELSE NULL END FROM #{table} WHERE id = #{id} ;] | |
| end | |
| def timeit |
| const CDN = process.env['CDN_HOST'] || ''; | |
| /** | |
| * Webpack configuration for integrating Webpack with Rails via the webpack-rails gem | |
| * (https://github.com/mipearson/webpack-rails) | |
| * | |
| * Cache-Busting Strategy: | |
| * Development: Change query string of resource when content MD5 hash changes, | |
| * rewriting the asset in place but triggering rewrite of the manifest. | |
| * Production: Use MD5 hash of asset as filename, writing new assets and manifest |