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 compareVersion (a, b) { | |
var parts_a = a.split('.'); | |
var parts_b = b.split('.'); | |
var length = Math.max(parts_a.length, parts_b.length); | |
parts_a = extendAsInt(parts_a, length); | |
parts_b = extendAsInt(parts_b, length); | |
return parts_a.reduce( function (prev, current, i, self) { | |
if (prev != 0) { return prev; } |
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
<?php | |
$array = array("123", "456A", "78"); | |
while ($array[0] < $array[1]) { | |
echo "{$array[0]} < {$array[1]}" . PHP_EOL; | |
array_push($array, array_shift($array)); | |
} |
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 | |
require 'open-uri' | |
require 'nokogiri' | |
require 'json' | |
class AsusRma | |
attr_accessor :json, :data | |
@@url = "http://www.asus.com/support/Repair-Status-Result" | |
@rmano = '' |
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
Game update: AppID 220200 "Kerbal Space Program", ProcID 3712, IP 0.0.0.0:0 | |
ERROR: ld.so: object '/home/bisbyx/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. | |
ERROR: ld.so: object '/home/bisbyx/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. | |
Found path: /home/bisbyx/.local/share/Steam/SteamApps/common/Kerbal Space Program/KSP.x86_64 | |
Mono path[0] = '/home/bisbyx/.local/share/Steam/SteamApps/common/Kerbal Space Program/KSP_Data/Managed' | |
Mono path[1] = '/home/bisbyx/.local/share/Steam/SteamApps/common/Kerbal Space Program/KSP_Data/Mono' | |
Mono config path = '/home/bisbyx/.local/share/Steam/SteamApps/common/Kerbal Space Program/KSP_Data/Mono/etc' | |
Aborted | |
Game removed: AppID 220200 "Kerbal Space Program", ProcID 3712 |
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
<?php | |
$X = isset($argv[1]) ? $argv[1] : 175; | |
$n = isset($argv[2]) ? $argv[2] : 10; | |
$y = $X/$n; | |
$result = range($y - ($n-1)/2, $y + ($n-1)/2); | |
$resum = array_reduce($result, function($carry, $item) { | |
return $carry + $item; |
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
total = ARGV[0] ? ARGV[0].to_i : 175 | |
ways = ARGV[1] ? ARGV[1].to_i : 10 | |
avg = total/ways | |
min = avg - (ways-1)/2 | |
max = avg + (ways-1)/2 + 1 | |
result = *(min..max) | |
resum = result.reduce(:+) | |
puts "Start "+total.to_s |
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
hw = [100, 85, 80, 95] | |
hw_avg = hw.inject(:+).to_f/hw.size | |
hw_weight = 35 | |
midterm_score = 84 | |
midterm_weight = 25 | |
pmtg = 91 | |
final_weight = 40 |
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
<?php | |
function sum($callback, $range) { | |
return array_reduce($range, function($carry, $item) use ($callback) { | |
return $carry + $callback($item); | |
}); | |
} | |
$test = function($x) { return (float) 1/$x; }; | |
$y = sum($test, range(1, 3)); // 1/1 + 1/2 + 1/3 = 11/6 |
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 'prime' | |
def factorize x | |
factors = [] | |
if x == 1 then return factors end | |
while !Prime.prime? x | |
lf = lowestFactor x | |
factors.push lf | |
x = x/lf | |
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
[Desktop Entry] | |
Version=1.0 | |
Type=Application | |
Name=Battle.net | |
Comment=Play Blizzard games | |
Icon=4F3B_Battle.net Launcher.0 | |
Exec=env winearch=win64 WINEPREFIX="/home/nbisby/.wine64" wine "/mnt/megatron/Programs/Battle.net/Battle.net Launcher.exe" | |
Path=/home/nbisby/gamedisk/Battle.net | |
NoDisplay=false | |
Categories=Game; |
OlderNewer