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
$ make | |
c++ -c -o bitboards.o bitboards.cpp | |
In file included from bitboards.cpp:16: | |
./procs.h:11:10: warning: calling convention '__stdcall' ignored for this target [-Wignored-attributes] | |
unsigned __stdcall engine_loop(void* pArguments); | |
^ | |
bitboards.cpp:275:56: warning: integer constant is larger than the largest signed integer type | |
assert(cannot_catch_pawn_mask[BLACK][BLACK][G5] == 18446470308215914496); | |
^ | |
/usr/include/assert.h:93:25: note: expanded from macro 'assert' |
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
# Ante script by Richard Notley | |
# Print N51°17.252W0°36.952\n | |
# | |
9♥ 3♥ 5♠ 8♥ # ♥ = 9 * 3 - 5 * 8 = 176 [°] | |
5♣ 4♠ # ♣ = 5 - 4 = 1 | |
3♦ 6♥ # ♦ = 3 * 6 = 18 | |
Q♦ # Label | |
A♣ 5♦ # ♣ = ♣ + 5 => increment ♣ by 5 (9 iterations from ♣ = 1) => ♣ = 46 [.] | |
A♦ 2♠ # ♦ = ♦ - 2 => decrement ♦ (counter) by 2 |
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 Controller | |
attr_reader :tag | |
def initialize | |
@tag = "Controller" | |
@window = Window.new(self) | |
@window.show | |
hello | |
hello_again | |
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
app = UIApplication.sharedApplication | |
NSLog "statusBarHidden #{app.statusBarHidden.inspect rescue nil}" # fails (documented) | |
NSLog "statusBarHidden? #{app.statusBarHidden?.inspect rescue nil}" # passes (undocumented) | |
NSLog "idleTimerDisabled #{app.idleTimerDisabled.inspect rescue nil}" # fails (documented) | |
NSLog "idleTimerDisabled? #{app.idleTimerDisabled?.inspect rescue nil}" # passes (undocumented) | |
NSLog "networkActivityIndicatorVisible #{app.networkActivityIndicatorVisible.inspect rescue nil}" # fails (documented) | |
NSLog "networkActivityIndicatorVisible? #{app.networkActivityIndicatorVisible?.inspect rescue nil}" # passes (undocumented) | |
### However: |
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 Alert | |
def initialize(title, message, *buttons) | |
# | |
# Delegating to self. | |
# | |
@alert = UIAlertView.alloc.initWithTitle(title, message:message, delegate:self, cancelButtonTitle:"Cancel", otherButtonTitles:"OK", nil) | |
@alert.show | |
self | |
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
# -*- coding: utf-8 -*- | |
$:.unshift("/Library/RubyMotion/lib") | |
require 'motion/project' | |
require '~/Source/Ruby/Motion/motion_awesome_print/lib/awesome_print' | |
Motion::Project::App.setup do |app| | |
# Use `rake config' to see complete project settings. | |
app.name = 'hello' | |
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
function k() { | |
kill -9 $(ps ax | grep $1 | grep -v grep | awk '{print $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
# Plain bubble sort. | |
def bubble_sort(array) | |
loop do | |
swapped = false | |
(array.size - 1).times do |i| | |
if array[i] > array[i+1] | |
array[i], array[i+1] = array[i+1], array[i] | |
swapped = true | |
end | |
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
window.console or do -> | |
window.console = {} | |
for method in [ "log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd" ] | |
window.console[method] = -> | |
return |
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
# Original | |
Dir.glob("./commands/*.rb").each do |command| | |
$commands << command.split("/").last.split('.rb').first | |
end | |
# Refactored | |
Dir.glob("./commands/*.rb").each do |command| | |
$commands << File.basename(command, '.*') | |
end |
NewerOlder