Skip to content

Instantly share code, notes, and snippets.

View caok's full-sized avatar

Clark caok

View GitHub Profile
@antife-yinyue
antife-yinyue / highlight.scss
Created February 22, 2013 05:32
Highlight styles in GitHub
pre, code {
font-family: Consolas, 'Liberation Mono', Courier, monospace;
}
.highlight {
pre {
padding: 6px 10px;
border: 1px solid #ccc;
border-radius: 3px;
background-color: #f8f8f8;
overflow: auto;
@kennyz
kennyz / kongwu_pi_tips.md
Last active December 25, 2021 12:41
kongwu pi tips

折腾Pi,解决疑难杂症最好还是去官网论坛

image http://www.raspberrypi.org/phpBB3/

支持Apple TimeMachine,实现Mac备份

在磁盘中创建备份目录 mkdir /media/usbdisk/mactimebak 推荐使用ext4分区(打开notime)

安装nettalk

@stas
stas / deploy.rb
Created January 15, 2013 15:34
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@polotek
polotek / ember_hurdles.md
Last active March 30, 2017 05:37
Hurdles getting started with Ember.js

This is a brain dump of my experience trying to get something going with Ember.js. My goal was to get to know the ins and outs of the framework by completing a pretty well defined task that I had lots of domain knowledge about. In this case reproducing a simple Yammer feed. As of this time, I have not been able to complete that task. So this is a subjective rundown of the things I think make it difficult to get a handle on Ember. NOTE: My comments are addressing the Ember team and giving suggestions on what they could do to improve the situation.

App setup

The new guides have pretty good explanation of the various parts of the framework; routers, models, templates, views. But it's not clear how they all get strapped together to make something that works. There are snippets of examples all over the place like:

App.Router.map(function() {
  match('/home').to('home');
});
@doitian
doitian / edit.html.erb
Created December 16, 2012 13:11 — forked from masqita/type_caster.rb
Add a active model wrapper to edit settings in form. `type_caster.rb` can be put in lib directory, which convert the field to specific type. The wrapper idea also can be used to wrap any other object, such as [Railscasts #396](https://github.com/railscasts/396-importing-csv-and-excel/blob/master/store-with-validations/app/models/product_import.rb)
<h1>Settings</h1>
<%= simple_form_for @settings, :as => 'settings', :url => admin_settings_path, :html => { :class => 'form form-horizontal' } do |f| %>
<fieldset>
<legend>Points Earning</legend>
<%= f.input :site_name %>
<%= f.input :per_page %>
</fieldset>
<div class="control-group">
@happypeter
happypeter / happycasts_sync.sh
Last active July 3, 2020 07:54
upload my assets to the server
#!/usr/bin/env bash
sync_dryrun()
{
echo
echo -e "\033[1m ...dryrun...\033[0m"
rsync -av --delete ~/happycasts/episodes/ peter@linode:~/media/assets/episodes/ --dry-run
echo -e "\033[1m ...dryrun...\033[0m"
echo
}
@ryanb
ryanb / expectations.md
Created December 6, 2012 01:04
Alternative expectation interface for MiniTest and RSpec

Expectations

I took the ideas presented here and built a gem called Mustard. Check it out!

There are several expectation/assertion interfaces available for writing tests/specs. Here are some issues I have with them.

Test::Unit/MiniTest

  • The order of assert_equals feels backwards
  • Oh wait, that should be assert_equal (that too)
@happypeter
happypeter / unicorn_init.sh
Created October 30, 2012 00:27
Restart Unicorn init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage unicorn server
# Description: Start, stop, restart unicorn server for a specific application.
### END INIT INFO
@happypeter
happypeter / deploy.rb
Created October 30, 2012 00:23
Capistrano recip
require "bundler/capistrano"
set :application, "blog"
set :repository, "[email protected]:happypeter/blog.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :user, "deployer"
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, true
@zernel
zernel / Gemfile
Created August 24, 2012 01:45
Devise authentication with multiple provider
gem 'devise'
gem 'omniauth'
gem 'omniauth-github'
gem "omniauth-twitter"
gem "omniauth-facebook"
gem "omniauth-google-oauth2"