Skip to content

Instantly share code, notes, and snippets.

View eddix's full-sized avatar

eddix eddix

  • Beijing
  • 01:29 (UTC +08:00)
View GitHub Profile
@eddix
eddix / squirrel.custom.conf
Created May 22, 2022 08:20
Squirrel Color
moradi:
name: 莫兰迪
author: eddix
horizontal: true
candidate_format: "%c\u2005%@"
font_point: 16
label_font_point: 14
corner_radius: 5
line_spacing: 10
back_color: '0xa79686'
#!/bin/env python
from collections import defaultdict
from random import randint
def mute(number, plane):
"""
mute invalid number
"""
muted = set()
@eddix
eddix / myapple.zsh-theme
Created May 18, 2016 07:40
myapple.zsh-theme
function toon {
echo -n ""
}
get_git_dirty() {
git diff --quiet || echo '*'
}
autoload -Uz vcs_info
#autoload -U colors && colors
" .vimrc by eddix
" $ git clone http://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" $ PluginInstall
if has("gui_macvim")
" cancel default hot-key
let macvim_skip_cmd_opt_movement = 1
let macvim_hig_shift_movement = 1
set transparency=2
@eddix
eddix / gist:6619826
Created September 19, 2013 06:43 — forked from dhh/gist:1014971
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@eddix
eddix / nginx.conf
Created May 15, 2013 10:28
capstrino + unicorn + nginx
upstream mostor_backend {
server unix:/tmp/unicorn.mostor-website.sock fail_timeout=0;
}
server {
listen 80;
root /home/work/www/mostor/current/public/;
client_max_body_size 1000m;
location ^~ /assets/ {
@eddix
eddix / app_path.c
Created March 22, 2013 07:44
get application real path in c. it needs argv[0].
/* app_path
*
* get application path, it need argv[0], and store the result to path.
*
* */
char * app_path(char * path, const char * argv0)
{
char buf[PATH_MAX];
char * pos;
if (argv0[0] == '/') { // run with absolute path
@eddix
eddix / object.lua
Created March 20, 2013 01:45
Lua Object Prototype
-- Lua Object Prototype
Robot = {name = "Eddix", id = 001}
function Robot:new()
self.__index = self
local t = setmetatable({}, self)
return t
end
@eddix
eddix / update_password.rb
Created March 11, 2013 07:03
Update password in devise. Integrated with Grape::Entities
if current_user.update_with_password({:current_password => params[:current_password], :password => params[:password]})
current_user.reset_authentication_token!
present current_user, :with => APIEntities::User
else
present current_user, :with => APIEntities::UserError
end
@eddix
eddix / form_builder.rb
Created January 18, 2013 09:06
customize f.label in Rails
# config/initializers/form_builder.rb
class ActionView::Helpers::FormBuilder
alias :origin_label :label
def label(method, content_or_options = nil, options = nil, &block)
if content_or_options && content_or_options.class == Hash
options = content_or_options
else
content = content_or_options