Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am elektronaut on github.
  • I am inge (https://keybase.io/inge) on keybase.
  • I have a public key whose fingerprint is 4EFE DC55 D0A4 D15C 74A1 5C8B A9F5 7E26 968D 6B8E

To claim this, I am signing this object:

# What I intended
def foo
@foo ||= begin
expensive_operation
end
end
# What emacs thinks it should look like
def foo
@foo ||= begin
Verifying that +inge is my openname (Bitcoin username). https://onename.io/inge
15/04/15 15:03:03,948 Paparazzi![5544]: WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.3 instead of 10.10.3. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.
Call location:
15/04/15 15:03:03,950 Paparazzi![5544]: 0 CarbonCore 0x00007fff862ce2b7 ___Gestalt_SystemVersion_block_invoke + 113
15/04/15 15:03:03,950 Paparazzi![5544]: 1 libdispatch.dylib 0x00007fff8e3b8c13 _dispatch_client_callout + 8
15/04/15 15:03:03,950 Paparazzi![5544]: 2 libdispatch.dylib 0x00007fff8e3b8b26 dispatch_once_f + 117
15/04/15 15:03:03,950 Paparazzi![5544]: 3 CarbonCore 0x00007fff86257456 _Gestalt_SystemVersion + 987
15/04/15 15:03:03,950 Paparazzi![5544]: 4 CarbonCore 0x00007fff862566e3 Gestalt + 144
15/04/15 15:03:03,950 Paparazzi![5544]: 5 Growl 0x00000001000af267 GrowlGetSystemVersion + 39
15/04/15 15:03:03,950 Paparaz
whitelist = [:email, :password, :and_so_on]
user_params = params
.keep_if { |k, v| whitelist.include?(k) && !v.nil? }
.merge(uuid: @user.uuid)
def superclass_instance(obj)
parent_obj = obj.class.superclass.new
obj.instance_variables.map(&:to_s).each do |name|
parent_obj.instance_variable_set(name, obj.instance_variable_get(name))
end
parent_obj
end
@elektronaut
elektronaut / safari-crash.html
Created June 27, 2015 00:45
Mobile Safari crash
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script>
$(function () {
$(".crash-button").on("click", function () {
prompt("This is a prompt");
});
});
</script>
color 1: #E29C17
color 2: #009914
color 1 in decimal: rgb(226, 156, 23)
color 2 in decimal: rgb(0, 153, 20)
colors blended:
rgb((226+0)/2, (156+153)/2, (23+20)/2)
= rgb(113, 154.5, 21.5)
tell application "System Events"
set theProcess to "something"
if (get name of processes contains theProcess) then
if (get visible of process theProcess) then
set visible of process theProcess to false
else
set visible of process theProcess to true
activate application theProcess
end if
else
#!/usr/bin/env ruby
# Usage:
#
# Create a list of installed gems:
# $ gem list > my_gems.txt
#
# Copy my_gems.txt to your target and pipe it through this script:
# $ cat my_gems.txt | ./install_gems.rb