This file contains hidden or 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 'benchmark' | |
def rc | |
rand(127).chr | |
end | |
ITER = 1_000_000 | |
puts "\n\n rb_format_str" | |
Benchmark.bm do | x| |
This file contains hidden or 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 'strscan' | |
class SloppyParser < StringScanner | |
def skip_until(pattern) | |
pattern.is_a?(String) ? super(/#{Regexp.escape(pattern)}/m) : super(pattern) | |
end | |
def scan_until(pattern) | |
pattern.is_a?(String) ? super(/#{Regexp.escape(pattern)}/m) : super(pattern) | |
end |
This file contains hidden or 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
$KCODE = 'u' | |
require 'test/unit' | |
module Vodka | |
const_set("TАБЛИЦА", { | |
"R" => "Я", | |
"Y" => "Ч", | |
"U" => "Ц", | |
"B" => "Б", | |
"N" => "И", |
This file contains hidden or 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 char *pluginSignature = "my.super.expensive.plugin"; | |
#ifdef APL | |
// Mac-specific: it IS possible to have plugin installed twice, once in the ACF folder | |
// and once in the X-System folder. Probably due to namespace mangling on OS X | |
// the system will NOT crash the app when the plugin gets loaded twice. | |
// Thus, we query the enabled plugins for the defined signatures | |
// and DO NOT activate should the other plugin already be plugged in | |
XPLM_API XPLMPluginID other_copy_id = XPLMFindPluginBySignature(pluginSignature); |
This file contains hidden or 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
<?xml version="1.0"?> | |
<!-- | |
To override or add "named" joystick drivers list them in | |
<js-named> entries with paths relative to the directory where | |
the joysticks.xml file resides (first example). Such "named" | |
drivers are only picked up if one of their <name>s matches | |
the joystick hardware (see output of the js_demo application). | |
These drivers have precedence over already existing drivers | |
with the same <name>. (You can also add a <name>default</name> | |
entry to the driver to make it the default choice.) |
This file contains hidden or 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
var axisHandlerPerIndex = func(pre, post) { | |
func(idx = 0) { | |
var val = cmdarg().getNode("setting").getValue(); | |
setprop(pre ~ idx ~ post, (1 - val) / 2); | |
} | |
} | |
var throttleAxisPerEngine = axisHandlerPerIndex("/controls/engines/engine[", "]/throttle"); |
This file contains hidden or 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
<js n="0" include="Input/Joysticks/CH/pro-yoke-usb.xml"/> | |
<js n="1" include="Input/Joysticks/Saitek/Pro-Flight-Quadrant-Left.xml"/> | |
<js n="2" include="Input/Joysticks/Saitek/Pro-Flight-Quadrant-Right.xml"/> | |
<js n="3" include="Input/Joysticks/CH/pro-pedals-usb.xml"/> |
This file contains hidden or 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
<axis n="0"> | |
<desc>Prop Pitch</desc> | |
<binding> | |
<command>nasal</command> | |
<script>controls.propellerAxis()</script> | |
</binding> | |
</axis> | |
<axis n="1"> | |
<desc>Throttle 1</desc> | |
<binding> |
This file contains hidden or 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
<axis n="0"> | |
<desc>Throttle 3</desc> | |
<binding> | |
<command>nasal</command> | |
<script>controls.throttleAxisPerEngine(2)</script> | |
</binding> | |
</axis> | |
<axis n="1"> | |
<desc>Prop Pitch</desc> |
This file contains hidden or 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
var throttleAxisForEngine = axisHandlerPerIndex("/controls/engines/engine[", "]/throttle"); | |
var axisHandlerPerIndex = func(pre, post) { | |
func(idx = 0) { | |
var val = cmdarg().getNode("setting").getValue(); | |
setprop(pre ~ idx ~ post, (1 - val) / 2); | |
} | |
} | |
var throttleAxisForEngine = axisHandlerPerIndex("/controls/engines/engine[", "]/throttle"); |