Skip to content

Instantly share code, notes, and snippets.

@makevoid
makevoid / hosted_example.txt
Created August 27, 2011 02:01
JQuery DOM HighLighter (it's a basic "Inspect element" simple implementation to mimic what webkit inspector and firebug do)
http://uploads.makevoid.com/jquery_dom_highlighter.html
@rummelonp
rummelonp / jquery-ujs.sample.md
Created December 13, 2011 02:25
jquery-ujs.js(rails.js)便利だよって話

jquery-ujs.js(rails.js)便利だよって話

自前でやる場合

JavaScript でクリックのイベント処理とか GET 以外ならトークンを含めるとか全部やらないといけないから面倒くさい

HTML

<a href="/some_action" class="some-action">some action</a>
#!/bin/bash
function cmd() {
target=$1; shift
pane=$1; shift
tmux send-keys -t:$target.$pane "$*" C-m
}
function window() {
tmux new-window -a -n "$1"
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@makotoworld
makotoworld / gist:3234813
Created August 2, 2012 07:27
Social Button
<div class="social-buttons" data-url="http://www.deafway.jp/"></div>
<script type="text/javascript">
<!--
$(document).ready(function() {
var mixi_favorite_parse = function() {
$('div[data-plugins-type="mixi-favorite"]:empty').each(function(i, e) {
new window.__MIXI_PLUGINS__.FavoriteFrame(e);
});
@Gab-km
Gab-km / github-flow.ja.md
Last active October 29, 2024 10:17 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
#!/var/lib/jenkins/.rvm/bin/rvm-shell ruby-1.9.3-p194@sqale
export RAILS_ENV=test
bundle install --without production
git checkout -b feature/bundle-update-`date +%Y%m%d`
bundle update
git add Gemfile Gemfile.lock
git commit -m 'bundle update'
git push origin feature/bundle-update-`date +%Y%m%d`
@naoty
naoty / factories.rb
Last active October 30, 2017 08:52
FactoryGirl.define do
factory :user do
after(:create) do |user|
FactoryGirl.create_list(:task, 10, user_id: user.id)
end
end
factory :task do
trait :with_user do
user
@smoil
smoil / account.rb
Last active March 2, 2020 00:32
Ajax select/multi select in Rails using Select2
class Account < ActiveRecord::Base
def self.search(name = nil)
# search logic
end
end
@moroya
moroya / aitter.js
Last active December 18, 2015 00:39
Amazon ikuratukatter
(function(){
var total = {};
var year = '2012';
var all = false;
function init(num) {
if(typeof num !== 'number') {
num = 0;
$('<div/>').css({
position: 'fixed',
left: 0,