Skip to content

Instantly share code, notes, and snippets.

@zealinux
zealinux / application_controller.rb
Created November 12, 2012 08:38 — forked from gonzedge/application_controller.rb
Rails 3.1 - Adding custom 404 and 500 error pages
class ApplicationController < ActionController::Base
# ...
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: lambda { |exception| render_error 500, exception }
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception }
end
private
def render_error(status, exception)
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with :truncation
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
@zealinux
zealinux / rails_resources.md
Created January 21, 2014 03:40 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@zealinux
zealinux / javascript_resources.md
Created January 21, 2014 03:40 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@zealinux
zealinux / css_resources.md
Created January 21, 2014 03:40 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@zealinux
zealinux / vine_to_gif.rb
Created November 13, 2015 13:54 — forked from seyhunak/vine_to_gif.rb
Vine.co mp4 to GIF using Ruby
# space150 vine-to-GIF
# given a vine.co uri, downloads the MP4 and creates an image sequence / GIF from it
# requires ruby, ffmpeg, and imagemagick
require 'open-uri'
require 'nokogiri'
id = ARGV[0]
# try to convert from URL to id.
@zealinux
zealinux / multiple_ssh_setting.md
Created November 18, 2015 00:31 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@zealinux
zealinux / install_ruby_2_0_0_p247_on_osx.md
Created November 30, 2015 06:11 — forked from runlevel5/install_ruby_2_0_0_p247_on_osx.md
Installing Ruby 2.0.0-p247 on OSX 10.7+

How to install Ruby 2.0.0-p247 on Mac OSX 10.7+

RVM:

rvm get stable && rvm reload

Firstly, the OpenSSL comes with your OSX 10.7+ is outdated, you need to get latest version

@zealinux
zealinux / make-flashlight-work-on.yosemite.md
Created February 15, 2016 06:38 — forked from selaromi/make-flashlight-work-on.yosemite.md
Steps to make Flashlight work on 10.10.4 (doesn't work for El Capitan)

Make Flashlight work on 10.10.4

  1. Install SIMBL http://culater.net/software/SIMBL/SIMBL.php
  2. Copy SpotlightSIMBL.bundle to /Library/Application Support/SIMBL/Plugins/ (a)
  3. Copy Flashlight.osax to ~/Library/ScriptingAdditions/ (b)
  4. Disable Flashlight
  5. Enable Flashlight
  6. Open Script Editor on your Mac (look for "Script Editor In Spotlight") and paste the following code (don't change Snow Leopard for Yosemite)
tell application "Spotlight" to inject SIMBL into Snow Leopard

前端工程师-开放性笔试

1. HTML / CSS

以下三个效果图中任选一个,尽可能还原。(不限框架,工具,预编译语言)

点击查看大图

兼容性要求:Chrome / Firefox / IE 11 / Edge

其他:部署至jsfiddle / jsbin / github page或同类网站