Skip to content

Instantly share code, notes, and snippets.

View msg7086's full-sized avatar

Xinyue Lu msg7086

  • Greater Portland, OR
  • 02:25 (UTC -07:00)
View GitHub Profile
@altherlex
altherlex / description_component.rb
Last active February 13, 2017 20:23
Simple_form in show
#config/initializers/simple_form/description_component.rb
module SimpleForm
module Components
# Needs to be enabled in order to do automatic lookups
module Description
# Name of the component method
def desc(wrapper_options = nil)
object.send(attribute_name) if @builder.instance_variable_get('@lookup_action') == :show
end
end
@zer4tul
zer4tul / 提问的智慧.md
Last active July 23, 2024 08:58
Simplified Chinese edition of "How To Ask Questions The Smart Way"
@archan937
archan937 / Rakefile
Created January 8, 2014 10:49
Override Rake::Task.define_task for cleaner arguments passing
require_relative "task"
desc "Send an invite"
task :invite do |name, email|
puts "Invitation sent to '#{name} <#{email}>'"
end
# Example:
#
# $ rake invite "Paul Engel" paul@engel.com
@royshil
royshil / gist:6318407
Created August 23, 2013 11:39
A CMake Find module for FFMPEG that will tear the HD apart looking for the libs and includes ;)
# - Try to find FFMPEG
# Once done this will define
# FFMPEG_FOUND - System has FFMPEG
# FFMPEG_INCLUDE_DIRS - The FFMPEG include directories
# FFMPEG_LIBRARIES - The libraries needed to use FFMPEG
# FFMPEG_LIBRARY_DIRS - The directory to find FFMPEG libraries
#
# written by Roy Shilkrot 2013 http://www.morethantechnical.com/
#
@ArturT
ArturT / .travis.yml
Last active July 12, 2017 01:40
Speed up Travis CI builds by caching the bundle to ftp. Based on s3 example: https://gist.github.com/matiaskorhonen/5203327 See README.md
---
language: ruby
rvm:
- 2.0.0
bundler_args: --without development --path=~/.bundle
env:
global:
- BUNDLE_ARCHIVE="app-bundle-archive"
- RAILS_ENV=test
- secure: "A_VERY_LONG_SERIES_OF_CHARACTERS_HERE"
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active June 29, 2024 23:43
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@youzaka
youzaka / captiondumper.py
Created December 31, 2011 15:12
字幕ダンプ
#!/usr/bin/env python
import hashlib
from collections import defaultdict
from io import BufferedReader, FileIO
from aribgaiji import GAIJI_MAP
"""
TSファイルから字幕を取り出すスクリプト。
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')