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
Let's see where we don't agree (this code doesn't do purge_nulls): | |
Mismatch: | |
orig: {"a":"foo","b":[3,null,{"x":null}]} | |
patch: {"b":[3,null,{"x":null}]} | |
draft: {"a":"foo","b":[3,{}]} | |
actual: {"a":"foo","b":[3,null,{"x":null}]} | |
Mismatch: | |
orig: [1,2] | |
patch: [1,null,3] | |
draft: [1,3] |
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
#!/usr/bin/env ruby | |
require 'mechanize' | |
URL = 'https://elearning.uni-bremen.de' | |
agent = Mechanize.new | |
page = agent.get(URL) | |
login_page = page.link_with(text: /for registered users/).click |
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
float decode_half(int half) { | |
union { uint32_t u; float f; } val; | |
val.u = (half & 0x7fff) << 13 | (half & 0x8000) << 16; | |
if ((half & 0x7c00) != 0x7c00) | |
return val.f * 0x1p112; | |
val.u |= 0x7f800000; | |
return val.f; | |
} |
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
(defun electric-pair-better-inhibit (char) | |
(or | |
(eq char (char-after)) | |
(and | |
(eq char (char-before (1- (point)))) | |
(let* ((syntax (electric-pair-syntax char))) | |
(not (eq syntax ?\()))) | |
(eq (char-syntax (following-char)) ?w))) |
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
(defun cabo:nxml-balanced-close-start-tag-block () | |
"Close the start-tag before point with `>' and insert a balancing end-tag. | |
Point is left between the start-tag and the end-tag. | |
If there is nothing but whitespace before the `<' that opens the | |
start-tag, then put point on a blank line, and put the end-tag on | |
another line aligned with the start-tag." | |
(interactive "*") | |
(nxml-complete) | |
(nxml-balanced-close-start-tag-block)) |
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
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <rpc/rpc.h> | |
#include <sys/time.h> | |
#include <string.h> | |
#include <arpa/inet.h> |
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
function ej() { | |
for i | |
do | |
echo ejecting /Volumes/"$i"... | |
hdiutil eject /Volumes/"$i" | |
done | |
} | |
function _ej() { | |
local cur="${COMP_WORDS[COMP_CWORD]}" | |
local v=$(cd /Volumes/; find -x . -type d -depth 1 | sed s/..//) |
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
(defun hs-hide-all-comments () | |
"Hide all top level blocks, if they are comments, displaying only first line. | |
Move point to the beginning of the line, and run the normal hook | |
`hs-hide-hook'. See documentation for `run-hooks'." | |
(interactive) | |
(hs-life-goes-on | |
(save-excursion | |
(unless hs-allow-nesting | |
(hs-discard-overlays (point-min) (point-max))) | |
(goto-char (point-min)) |
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
#!/opt/local/bin/ruby1.9 | |
require 'nokogiri' | |
doc = Nokogiri::XML(ARGF).css("node").each do |node| | |
if t = node["TEXT"] | |
puts "#{"*" * node.ancestors("node").size}* #{t}" | |
end | |
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
; Upon drag-and-drop to a frame (OSX window): Find the file in the frame, | |
; with shift: insert filename(s), space-separated; | |
; with control: insert filename(s) as lines, repeating the beginning of the line; | |
; with meta: insert file contents | |
; note that the emacs window must be activated (CMD-TAB) for the modifiers to register | |
(define-key global-map [M-ns-drag-file] 'ns-insert-file) | |
(define-key global-map [S-ns-drag-file] 'ns-insert-filename) | |
(define-key global-map [C-ns-drag-file] 'ns-insert-filename-as-lines) | |
(define-key global-map [ns-drag-file] 'ns-find-file-in-frame) |