Skip to content

Instantly share code, notes, and snippets.

(defun viper-escape-if-next-char (c)
"Watches the next letter. If c, then switch to viper mode, otherwise insert a j and forward unpressed key to unread-command-events"
(self-insert-command 1)
(let ((next-key (read-event)))
(if (= c next-key)
(progn
(delete-backward-char 1)
(viper-mode))
(setq unread-command-events (list next-key)))))
@windless
windless / disable_action_bar.xml
Created September 15, 2014 07:32
Disable android action bar
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
@windless
windless / json_to_list.java
Created October 2, 2014 08:29
Gson json to list
List<Student> retList = gson.fromJson(s2,
new TypeToken<List<Student>>() {
}.getType());
@windless
windless / animate_navigationbar.swift
Created October 22, 2014 05:54
Change UINavigation background image with animation
var animation = CATransition()
animation.duration = 0.3
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
animation.type = kCATransitionFade
self.navigationController?.navigationBar.layer.addAnimation(animation, forKey: nil)
self.navigationController?.navigationBar
.setBackgroundImage(UIImage(named: "enjory_menubar"), forBarMetrics: UIBarMetrics.Default)
@windless
windless / hex_color.swift
Created October 23, 2014 06:01
UIColor hexColor
extension UIColor {
class func hexColor(hex: Int, alpha: Double = 1) -> UIColor {
let red = Double((hex & 0xFF0000) >> 16) / 255.0
let green = Double((hex & 0xFF00) >> 8) / 255.0
let blue = Double((hex & 0xFF)) / 255.0
return UIColor(red: CGFloat(red), green: CGFloat(green), blue: CGFloat(blue), alpha: CGFloat(alpha) )
}
}
redis-cli --scan --partten "keys:*" | xargs redis-cli del
call plug#begin('~/.local/share/nvim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'ervandew/supertab'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
Plug 'padde/jump.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'dracula/vim', { 'as': 'dracula' }