Skip to content

Instantly share code, notes, and snippets.

View JuanitoFatas's full-sized avatar
🧸
Building Buildkite

Juanito JuanitoFatas

🧸
Building Buildkite
View GitHub Profile
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'arel'
gem 'pg'
GEMFILE
system 'bundle'
end
@SaitoWu
SaitoWu / linner.yml
Last active December 29, 2015 19:10
Linner configuration example.
paths:
app: "src"
public: "public"
groups:
scripts:
paths:
- "src/scripts"
concat:
"/pokeball.js": "{src,vendor}/**/*.{js,coffee}"
order:
@tsunagun
tsunagun / README.txt
Created November 11, 2013 05:40
rubyから形態素解析ライブラリkuromojiを利用する
README.txt
==========
kuromojiをrubyで利用するサンプル
1. kuromojiのダウンロード
wget https://github.com/downloads/atilika/kuromoji/kuromoji-0.7.7.tar.gz
tar zxf kuromoji-0.7.7.tar.gz
cd kuromoji-0.7.7
@aserafin
aserafin / resque.rake
Created October 10, 2013 10:10
clear all resque tasks from redis
desc "Clear pending tasks"
task "resque:clear" => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."
Resque.redis.del "queue:#{queue_name}"
end
puts "Clearing delayed..." # in case of scheduler - doesn't break if no scheduler module is installed
Resque.redis.keys("delayed:*").each do |key|
@yorkxin
yorkxin / README.md
Created September 16, 2013 06:43
HTML / Markdown filters by GitHub

html-pipeline: 把 text formatting 做成一層一層的 filter 接成 pipeline

linguist: 自動偵測一段文本或檔案的程式語言, GitHub 本身用它來偵測你專案使用的程式語言

charlock_holmes: 自動偵測文本的文字編碼,來自一個叫做 ICU 的資料庫,不知道是什麼,搜集了一堆文字編碼資訊和地區格式。

github-markdown: 實際在 GitHub 使用的 markdown compiler ,我找不到公開的 repo ,但程式碼是 MIT license ,很神秘…

github-markup: 用來把 README.md 這種檔案給 render 成 HTML

@maxim
maxim / rails_load_path_tips.md
Last active January 9, 2025 00:59
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@rgrinberg
rgrinberg / fiber_hangman.rb
Created August 25, 2013 18:22
hangman using ruby fibers
#!/usr/bin/env ruby
require 'fiber'
require 'set'
def state full_word, revealed
all_letters = full_word.split('') - [' ']
hidden = all_letters.to_set - revealed
hidden.inject(full_word) {|acc, e| acc.gsub e, '_' }
end
@joannecheng
joannecheng / rp5-install-notes.md
Last active December 21, 2015 05:18
Ruby-Processing install notes

Hello there! So you want to install Ruby-Processing and get started creating some fun programs.

You can simply type gem install ruby-processing from any installation of Ruby. Ruby-Processing requires JRuby to run, but it comes bundled with its own version of JRuby (granted, a very old version: 1.6.4). To run a sketch using an installed version of JRuby, just run your sketch with the --jruby flag. That way you can use installed gems in your sketches.

The version that lives on rubygems.org is the version of Ruby-Processing I used in my presentation. However, this version of Ruby-Processing is technically outdated: it uses Processing version 1.5.4, whereas the current version of Ruby-Processing is using Processing version 2.0.

There are a few reasons why I used an older version for my talk, and why I recommend people use the older version of Ruby-Processing:

  • It's easier to install: the current Ruby-Processing is too big for rubygems.org, so one needs to pull the repo down from github, install it on
@matthewrobertson
matthewrobertson / base_serializer.rb
Last active June 14, 2016 07:16
A simple pattern for creating classes that encapsulate JSON serialization logic. Simply inherit from the `BaseSerializer` and override the hook methods as necessary.
# An abstract base class used to create simple serializers
# for ActiveRecord objects
class BaseSerializer
include Rails.application.routes.url_helpers
attr_reader :serialized_object
def initialize(serialized_object)
@serialized_object = serialized_object
end
@jasonrudolph
jasonrudolph / 00-about-search-api-examples.md
Last active January 3, 2025 03:54
5 entertaining things you can find with the GitHub Search API