mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
18 lines
476 B
Plaintext
18 lines
476 B
Plaintext
# -*- mode: snippet -*-
|
|
# key: once
|
|
# contributor: Translated from TextMate Snippet
|
|
# name: Header Include-Guard
|
|
# --
|
|
#ifndef ${1:`#!/usr/bin/env ruby -wKU -riconv
|
|
name = ENV["TM_FILENAME"] || "untitled"
|
|
name = Iconv.iconv("ASCII//TRANSLIT", "UTF-8", name).first
|
|
name = name.gsub(/[^a-z0-9]+/i, "_")
|
|
uuid = (rand * 2821109907455).round.to_s(36)
|
|
print "#{name}_#{uuid}".tr("[a-z]", "[A-Z]")
|
|
`}
|
|
#define $1
|
|
|
|
${TM_SELECTED_TEXT/\Z\n//}${0:}
|
|
|
|
#endif /* end of include guard: $1 */
|