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 collections | |
import functools | |
import logging | |
from typing import Any, Callable, Iterable, Union | |
from google.protobuf.message import Message | |
from grpc import HandlerCallDetails, RpcMethodHandler, ServerInterceptor, ServicerContext, StatusCode | |
from grpc.experimental import wrap_server_method_handler | |
from validator import ValidationFailed, validate |
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
package main | |
import ( | |
"context" | |
"testing" | |
"time" | |
"github.com/ghodss/yaml" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
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
# Example workflow to demonstrate parameter aggregation. | |
apiVersion: argoproj.io/v1alpha1 | |
kind: WorkflowTemplate | |
metadata: | |
name: parameter-aggregation-template | |
spec: | |
templates: | |
# odd-or-even accepts a number and returns whether or not that number is odd or even | |
- name: odd-or-even | |
inputs: |
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
c = get_config() | |
from jupyterhub import handlers | |
handlers.default_handlers.extend([ | |
(r"/resources", ResourcesHandler), | |
]) |
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
module ConfidenceSearch | |
class << self | |
def search(start_num, end_num, &block) | |
(start_num..end_num).to_a.reverse.find { |n| block.call(n) } | |
end | |
def bin_ex_search(start_num, end_num, try_num: 1, last_num: nil, window: 1, &block) | |
return nil unless block.call(start_num) | |
num = try_num.times.find { |n| block.call(end_num - n + 1) } |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <time.h> | |
#define ARRAY_SIZE 10000 | |
#define MAX 100 | |
int solution1(int A[], int N) { | |
int total = 0; |
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
class LogicalDeleteUsers < ActiveRecord::Migration | |
def up | |
add_column :users, :logical_uniqueness, :boolean, default: true | |
remove_index :users, :name | |
add_index :users, [:name, :logical_uniqueness], unique: true | |
execute <<-SQL | |
CREATE TRIGGER `set_logical_uniqueness_on_users` BEFORE UPDATE ON `users` | |
FOR EACH ROW | |
BEGIN | |
IF NEW.`deleted_at` IS NULL THEN |
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
# Detect slow query slower than 1000 msec | |
Ext::ActiveRecord::SlowQuerySubscriber.load!(1000) |
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 * as windowContextRunner from './windowContextRunner.js' | |
windowContextRunner.run(function() { | |
// Do something and return the result | |
var result = 1; | |
return result; | |
}).then(function(result) { | |
// Use the result of the function above | |
result == 1 | |
}); |
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
case class BatchTriggerTick() |
NewerOlder