<Operation Class="[YOUR C# MOD NAMESPACE].PatchOperationAddOrReplace">
<xpath>/Defs/ThingDef[defName="Plant_TreeBirch"]/plant</xpath>
<key>growDays</key>
<value>22</value>
</Operation>
(function (context, trackingId, options) { | |
const history = context.history; | |
const doc = document; | |
const nav = navigator || {}; | |
const storage = localStorage; | |
const encode = encodeURIComponent; | |
const pushState = history.pushState; | |
const typeException = 'exception'; | |
const generateId = () => Math.random().toString(36); | |
const getId = () => { |
This is for adding the query parameters to the URL. These scripts can be also used for Javascript. When I created an endpoint with some query parameters, I had used the scripts of various patterns every time. Today, I prepared this sample script to unify them. If this is also useful for you, I'm glad.
String.prototype.addQuery = function (obj) {
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
require "rubocop" | |
module RuboCop | |
module Cop | |
module Lint | |
# This cop checks bad use of the Minitest `assert` method | |
# | |
# `assert` method's second argument is the error message when the | |
# first argument evals to false. | |
# |
#!/usr/bin/env ruby | |
# Takes a directory and turns music in it to mp3s; deleting originals. | |
require 'find' | |
require 'fileutils' | |
# Find files | |
files = [] | |
Find.find(ARGV.first) do |file| |
# config/initializers/postgres_types.rb | |
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES.tap do |t| | |
t[:primary_key] = "bigserial primary key" | |
t[:datetime] = "timestamptz" | |
t[:timestamp] = "timestamptz" | |
t[:string] = "text" | |
end |
launchctl unload -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist | |
launchctl load -w -S Aqua /System/Library/LaunchAgents/gpg.agent.daemon.plist |
/* include this file AFTER your standard includes */ | |
/* clang -Weverything -Wno-unused-macros */ | |
/* SIGNED ARITHMETIC IS THE ENEMY. (use "signed" for main, etc.) */ | |
#define int BANNED | |
/* THESE OTHER THINGS ARE ALSO THE ENEMY. */ | |
#ifdef strcpy | |
#undef strcpy | |
#endif | |
#define strcpy BANNED |
by 0xabad1dea, December 2014
This document is an RFC of sorts for increasing the adoption rate of Singular They in technical English. This is not an ultimatum; this is not shaming anyone who has done otherwise; and this is definitely not applicable to any other language.