Skip to content

Instantly share code, notes, and snippets.

@hara-y-u
hara-y-u / subscribeFeedlyBookmarklet.js
Created September 12, 2013 21:24
SubscribeFeedly Bookmarklet Source
// Compile with:
// http://subsimple.com/bookmarklets/jsbuilder.htm
(function(w) {
var r, i, u, t,
l = document.getElementsByTagName('link'),
ll = l.length;
for(i=0; i<ll; i++) {
if(l[i].getAttribute('rel') === 'alternate'
@hara-y-u
hara-y-u / list_template_methods.html.erb
Last active March 18, 2017 19:19
List Middleman helper methods/variables available in templates.
<% all_methods = self.class.superclass.instance_methods - self.class.superclass.superclass.instance_methods %>
<% output_helpers = ::Padrino::Helpers::OutputHelpers.instance_methods %>
<% tag_helpers = ::Padrino::Helpers::TagHelpers.instance_methods %>
<% asset_tag_helpers = ::Padrino::Helpers::AssetTagHelpers.instance_methods %>
<% form_helpers = ::Padrino::Helpers::FormHelpers.instance_methods %>
<% render_helpers = ::Padrino::Helpers::RenderHelpers.instance_methods %>
<% number_helpers = ::Padrino::Helpers::NumberHelpers.instance_methods %>
<% blog_helpers = Middleman::Blog::Helpers.instance_methods %>
<% mm_methods = all_methods - output_helpers - tag_helpers - asset_tag_helpers - form_helpers - render_helpers - number_helpers %>
@hara-y-u
hara-y-u / erb2slim.rake
Last active December 18, 2015 04:39
Rake Task to convert ERB to Slim using html2slim gem.
# Rake convert:erb2:slim converts every ERB files under `/app/views/**`.
# Original ERB files will be kept otherwise `delete` option is passed like:
# `$ rake "convert:erb2:slim[delete]"` .
namespace :convert do
namespace :erb2 do
ERBS = FileList["#{Rails.root}/app/views/**/*.erb"]
### Slim
require 'html2slim'
# generate tasks for slim files
@hara-y-u
hara-y-u / gist:5560729
Created May 11, 2013 17:32
Install gnu global with exuberant-ctags parser extension.
$ brew install global --with-exuberant-ctags
$ brew link --overwrite ctags #remove ctags not exuberant
;; auto-complete-mode
(setq ac-modes (append ac-modes '(objc-mode)))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/vendor")) ;; Set your own Path to auto-complete-clang.el
(setq ac-clang-flags (list "-D__IPHONE_OS_VERSION_MIN_REQUIRED=30200" "-x" "objective-c" "-std=gnu99" "-isysroot" xcode:sdk "-I." "-F.." "-fblocks"))
(require 'auto-complete-clang)
;; (setq ac-clang-prefix-header "stdafx.pch")
;; (setq ac-clang-flags '("-w" "-ferror-limit" "1"))
;(setq clang-completion-flags (list "-Wall" "-Wextra" "-fsyntax-only" "-ObjC" "-std=c99" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" "-I." "-F.." "-D__IPHONE_OS_VERSION_MIN_REQUIRED=30200"))
(add-hook 'objc-mode-hook
(lambda () (setq ac-sources (append '(ac-source-clang
@hara-y-u
hara-y-u / emacs.rb
Created August 17, 2012 16:33 — forked from sharl/emacs.rb
Yet Another Emacs 24.2 Homebrew Formula (fullscreen+IME inline)
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftpmirror.gnu.org/emacs/emacs-24.2.tar.bz2'
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-24.2.tar.bz2'
sha1 '38e8fbc9573b70a123358b155cf55c274b5a56cf'
if ARGV.include? "--use-git-head"
head 'http://git.sv.gnu.org/r/emacs.git'
@hara-y-u
hara-y-u / emacs.rb
Created August 15, 2012 13:37 — forked from rfkm/emacs.rb
Emacs24.1 Formula with inline-patch(+fix)
require 'formula'
class Emacs < Formula
homepage 'http://www.gnu.org/software/emacs/'
url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-24.1.tar.gz'
md5 '97b78dece2b4fd617dfab26b7db2d4bc'
depends_on "autoconf" => :build
if ARGV.include? "--use-git-head"
@hara-y-u
hara-y-u / gist:2701180
Created May 15, 2012 11:55
Emacs evil visual line move with j,k
(define-key 'evil-motion-state-map "j" evil-next-visual-line)
(define-key 'evil-motion-state-map "k" evil-previous-visual-line)
walk = (obj, fn, map = 'root') -> #fn(map, leaf)
if obj instanceof Array
for o in obj
walk o, fn, map + "[#{_i}]"
else if typeof obj is 'object'
for key of obj
walk obj[key], fn, map + ".#{key}"
else
fn map, obj
@hara-y-u
hara-y-u / init.el
Created March 2, 2012 09:00
Set path correctly even when Emacs has opened from desktop entry.
;; When opened from Desktep entry, PATH won't be set to shell's value.
(let ((path-str
(replace-regexp-in-string
"\n+$" "" (shell-command-to-string "echo $PATH"))))
(setenv "PATH" path-str)
(setq exec-path (nconc (split-string path-str ":") exec-path)))