This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
const compose = (...fns) => (val) => fns.reduceRight((x, fn) => fn(x), val); | |
const sum = (result, item) => result + item; | |
const mult = (a, b) => a * b; | |
function wrap(xf){ | |
return { | |
// 1. We require init as arg, so do not need here | |
init: function(){ | |
throw new Error('init not supported'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct cmpByStringLength { | |
bool operator()(const std::string& a, const std::string& b) const { | |
return a.length() < b.length(); | |
} | |
}; | |
// ... | |
std::map<std::string, std::string, cmpByStringLength> myMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn on_pointer(&mut self, state: &mut ApplicationState, position: Point2<f32>) { | |
let projection_matrix = create_projection_matrix(self.last_size); | |
let projection_inverse = projection_matrix.try_inverse().unwrap(); | |
// Transform the window position to a 3D ray from the camera | |
let ray_clip = Vector3::new( | |
(2.0 * position.x) / self.last_size.x as f32 - 1.0, | |
(2.0 * position.y) / self.last_size.y as f32 - 1.0, | |
// Remember, inverse Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* Plugin Name: WordPress Catch All Cache Buster | |
* Description: A quick catch-all cache-busting WordPress plugin when having clients clear their browser cache isn't an option. | |
* Version: 1.0.0 | |
* Author: Joseph Roberts | |
* Author URI: https://github.com/DigitalJoeCo | |
* License: MIT | |
* License URI: http://opensource.org/licenses/MIT | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Future versions of Hyper may add additional config options, | |
// which will not automatically be merged into this file. | |
// See https://hyper.is#cfg for all currently supported options. | |
module.exports = { | |
config: { | |
// Upload Hyper to github sync settings | |
syncSettings: { | |
quiet: false, | |
accelerators: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function diffObjects(x, y) { | |
if (x === y) return null; | |
if (x !== x) return y !== y ? null : y; | |
if (typeof x !== typeof y) return y; | |
if (typeof x !== 'object') return y; | |
var typeX = getType(x); | |
var typeY = getType(y); | |
if (typeX !== typeY) return y; | |
if (typeX === 'date' ) return +x === +y ? null : y; | |
if (typeX === 'array' ) return deepDiffArray(x, y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV CA_PATH="/etc/pki/ssl/ca" | |
RUN mkdir -p ${CA_PATH} | |
RUN curl -s -L "http://curl.haxx.se/ca/cacert.pem" -o "${CA_PATH}/mozilla.pem" | |
RUN openssl s_client -connect github.com:443 -CAfile ${CA_PATH}/mozilla.pem > ${CA_PATH}/github.pem | |
RUN curl --cacert ${CA_PATH}/github.pem -L -v https://github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group = 'com.fasterxml.jackson.core', module = 'jackson-databind', version = '2.10.1') | |
@Grab(group = 'org.springframework.boot', module = 'spring-boot-starter-amqp', version = '2.2.2.RELEASE') | |
import org.springframework.amqp.rabbit.core.RabbitTemplate | |
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory | |
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter | |
def cf = new CachingConnectionFactory(new URI('amqp://guest:guest@localhost:5672')) | |
def template = new RabbitTemplate(cf) | |
template.messageConverter = new Jackson2JsonMessageConverter() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# foureights.rb : "8-((8+8)/8)" Puzzle | |
# by takehikom | |
# see also: https://takehikom.hateblo.jp/entry/2020/01/11/062120 | |
# 環境変数LANGの値がja_JP.UTF-8などのときは, | |
# 日本語文字で出力する(実行時オプションで変更可能) | |
$option_zenkaku = /jp/i === ENV["LANG"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use core::future::Future; | |
async fn foo() -> u64 { | |
10 | |
} | |
async fn bar(x: impl Future<Output = u64>) { | |
println!("{}", x.await); | |
} |