Skip to content

Instantly share code, notes, and snippets.

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' }
redis-cli --scan --partten "keys:*" | xargs redis-cli del
@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) )
}
}
@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 / 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 / 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>
(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)))))
<!-- Application theme. -->
<style name="MyTheme" parent="@android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarStyle">@style/MyTheme.ActionBar</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@color/red_background</item>
</style>
<style name="MyTheme.ActionBar" parent="android:Widget.Holo.ActionBar">
<item name="android:background">@android:color/transparent</item>
<item name="android:backgroundStacked">@android:color/transparent</item>
#!/usr/bin/env bash
# Pre-requisites
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# Download and compile Ruby 2.1.2
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar -xvzf ruby-2.1.2.tar.gz
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
// enables hardware accelerated rounded corners
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/