Skip to content

Instantly share code, notes, and snippets.

View teddy1004's full-sized avatar

Teddy teddy1004

View GitHub Profile
@reyesyang
reyesyang / grape-i18n-zh-CN.yml
Last active March 7, 2024 14:52
Grape I18n translation in zh-CN language
# Usage:
# 1. Put this file in config/locales/grape/zh-CN.yml
# 2. Set load_path in config/application.rb as below:
# config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
zh-CN:
grape:
errors:
format: ! '%{attributes} %{message}'
messages:
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@lfender6445
lfender6445 / gist:9919357
Last active May 2, 2024 22:40
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@richardkall
richardkall / store.coffee
Last active December 3, 2023 22:08
Ember.js REST adapter without JSON root element.
App.Adapter = DS.RESTAdapter.extend
serializer: DS.RESTSerializer.extend
extract: (loader, json, type, record) ->
root = @rootForType(type)
// Embed JSON data in a new object with root element
newJSON = {}
newJSON[root] = json
json = newJSON
//
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 11, 2024 07:10
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@bschaeffer
bschaeffer / args.rb
Created March 7, 2012 23:28
Ruby *args examples
ids = [1,2,3]
def targs(*ids)
puts ids.length
puts ids.flatten.length
end
targs ids
#=> 1
#=> 3
@nazgob
nazgob / ctags.setup
Created January 6, 2012 13:44
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"