Skip to content

Instantly share code, notes, and snippets.

View danielma's full-sized avatar
🥇
You found the gold medal!

Daniel Ma danielma

🥇
You found the gold medal!
View GitHub Profile
<html>
<body>
<script>
Array.prototype.forEach.call(document.location.ancestorOrigins, function(origin) {
console.log(origin)
})
</script>
</body>
</html>
diff --git a/src/macappkit.m b/src/macappkit.m
index f4bc170cd2..22c57b7b41 100644
--- a/src/macappkit.m
+++ b/src/macappkit.m
@@ -2984,7 +2984,7 @@ - (void)updateCollectionBehavior
{
behavior = ((windowManagerState & WM_STATE_STICKY)
? NSWindowCollectionBehaviorCanJoinAllSpaces
- : NSWindowCollectionBehaviorMoveToActiveSpace);
+ : NSWindowCollectionBehaviorDefault);
diff --git a/src/macappkit.m b/src/macappkit.m
index f4bc170cd2..7846d62210 100644
--- a/src/macappkit.m
+++ b/src/macappkit.m
@@ -2141,7 +2141,7 @@ - (BOOL)canBecomeKeyWindow
- (BOOL)canBecomeMainWindow
{
- return self.isVisible && self.parentWindow == nil;
+ return self.parentWindow == nil;
require 'continuation'
counter = 0
inner_counter = 0
go_to_counter = callcc { |x| x }
counter += 1
puts "I've restarted #{counter} times"
go_to_inner_counter = callcc { |x| x }
require 'continuation'
counter = 0
inner_counter = 0
go_to_counter = callcc { |x| x }
counter += 1
puts "I've restarted #{counter} times"
go_to_inner_counter = callcc { |x| x }
class SuccessResult
def init(the_real_value_inside)
@the_real_value_inside
@ok_called = false
end
def ok?
@ok_called = true
end
class SuccessResult
def init(the_real_value_inside)
@the_real_value_inside
end
def ok?
true
end
def unwrap
[
{
"name": "0",
"url": "https://emoji.slack-edge.com/T024L9M0Y/oh/f6eabb423e54d16b.png",
"synonyms": [
"0",
"oh"
]
},
{
@danielma
danielma / opensong_to_chord_pro.rb
Created January 25, 2018 05:02
opensong -> chord pro
require 'awesome_print'
putting_chords_onto_next_line = nil
chords = DATA.each_line.map do |line|
if line.match(/^\./)
putting_chords_onto_next_line = line.to_enum(:scan, /([^\s.]+)/).map { Regexp.last_match }
next
end
@danielma
danielma / _wut.md
Created November 3, 2017 20:21
Delegator Probz

Delegator and try

It used to be that try was implemented on Object, which meant that try would always call the original object, instead of the delgator instance.

With Rails 5, updates were made that should mean that both DelegateClass(Doodad) and SimpleDelegator can both use try successfully, but it doesn't actually work!

As you can see in the example code, the SimpleDelegator class is able to resuce the error and the DelegateClass is not.

¯_(ツ)_/¯