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
#!/bin/bash | |
set -eou pipefail | |
# This script was partially inspired by https://arturdryomov.dev/posts/auto-github-pull-requests/ | |
# Few notes about some of the decisions that led to the code below: | |
# - The GitHub REST API does not support the marking PRs as ready for review. | |
# Instead, this has to be done through the GraphQL API, **and** requires a | |
# personal access token since the Github Action default token cannot have | |
# the required permission | |
# - It would have been cleaner to split up all the queries in this file as |
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
require "numo/narray" | |
require "numo/linalg" | |
def raking_inverse(x) | |
Numo::NMath.exp(x) | |
end | |
def d_raking_inverse(x) | |
Numo::NMath.exp(x) | |
end |
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
import numpy as np | |
def raking_inverse(x): | |
return np.exp(x) | |
def d_raking_inverse(x): | |
return np.exp(x) | |
def graking(X, T, max_steps=500, tolerance=1e-6): | |
# Based on algo in (Deville et al., 1992) explained in detail on page 37 in |
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
// Same as the other file, but this time as a JQuery plugin. | |
// Usage: $(someElement).getQuery(); | |
(function ($) { | |
$.fn.getQuery = function() { | |
var id = this.attr('id'); | |
var localName = this.prop('localName'); | |
if (id) | |
return '#' + escapeCSSString(id); |
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
// Keep the last N calls active | |
// A regular debounce function would only keep a single function call | |
// on timeout at a time. | |
function debounceGroup(func, wait, groupSize) { | |
var timeouts = []; // Use this array as a queue of method calls | |
return function() { | |
var context = this, | |
args = Array.prototype.slice.call(arguments, 0); | |
if (timeouts.length >= groupSize) | |
clearTimeout(timeouts.shift()); |
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
import { Component } from "React"; | |
export default (ComposedComponent) => class extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} |