Skip to content

Instantly share code, notes, and snippets.

View lunalium's full-sized avatar

Toi Dang lunalium

  • Ho Chi Minh, Viet Nam
View GitHub Profile
@lunalium
lunalium / unscoped.rb
Created February 2, 2016 04:36 — forked from lwe/unscoped.rb
Module which provides the ability to unscope associations
# Provides the ability to unscope associations, this solves problems described in
# http://stackoverflow.com/questions/1540645/how-to-disable-default-scope-for-a-belongs-to/11012633#11012633
#
# Examples
#
# class Document < ActiveRecord::Base
# default_scope where(deleted: false)
# end
#
# class Comment < ActiveRecord::Base
@lunalium
lunalium / Gemfile
Created February 2, 2016 04:07 — forked from mharris717/Gemfile
Minimal Pagination Example (Rails + Ember)
ruby '1.9.3'
source 'https://rubygems.org'
gem 'rails', '3.2.13'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
@lunalium
lunalium / solr_cap.rb
Created January 31, 2016 16:29 — forked from doitian/solr_cap.rb
sunspot solr in capistrano
namespace :deploy do
task :setup_solr_data_dir do
run "mkdir -p #{shared_path}/solr/data"
end
end
namespace :solr do
desc "start solr"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids"
/* Hide all possibilities in advance */
.firefox, .msie, .safari, .chrome, .win, .mac { display:none; }
/* Detect Internet Explorer 9 or Greater */
@media screen and (min-width:0\0) and (min-resolution: +72dpi) { .msie, .win { display:block; } }
/* Detect Internet Explorer 8 or Lower and veru old versions of Firefox */
@media \0screen\,screen\9 { .msie, .win { display:block; } }
/* Detect any version of Firefox */
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"detect_indentation": false,
"fade_fold_buttons": false,
"flatland_square_tabs": true,
"font_size": 11,
"highlight_line": true,
"ignored_packages":
@lunalium
lunalium / timezones.md
Created January 14, 2016 02:02 — forked from timrwood/timezones.md
Unique timezones for 2015
Offsets Time of Change Abbr Zone Candidates
-11:00 ??? Pacific/Pago_Pago
-11:00 NUT Pacific/Niue
-11:00 BST Pacific/Pago_Pago Pacific/Midway Pacific/Samoa
-10:00 -09:00 Mar 08 03:00 Nov 01 01:00 HDT HST America/Adak America/Atka
-10:00 ??? Pacific/Honolulu
-10:00 TAHT Pacific/Tahiti
@lunalium
lunalium / dirty-helpers.js
Created January 14, 2016 02:02 — forked from timrwood/dirty-helpers.js
Ember Data Dirty Relationships Mixins
import Ember from 'ember';
export { dirtyHasMany, dirtyBelongsTo, dirtyMixin };
var dirty = 'relationshipIsDirty';
function dirtyMixin (obj) {
var args = Object.keys(obj);
var comp = Ember.computed;
args.push('isDirty');
obj[dirty] = comp.any.apply(comp, args);
@lunalium
lunalium / percy-no-animations.css
Created January 2, 2016 07:03 — forked from fotinakis/freeze-css-animations.css
Stop transitions and animations in Percy rendering
@-moz-document domain(proxyme.percy.io) {
* {
-moz-transition: none !important;
transition: none !important;
-moz-animation: none !important;
animation: none !important;
}
}
// Wrapping a function with $() will wait until the page is ready
$(function() {
// Find our target <div>s
var preloader = $('#imagePreloader');
var loadingCover = $('#loadingCover');
var imageCount = 50;
var loadedImages = 0;
@lunalium
lunalium / usage.hbs
Created December 26, 2015 03:46 — forked from FezVrasta/usage.hbs
Wormhole for ember 1.6
{{#view SDC.WormholeView to="someElementId"}}
I'll be rendered somewhere
{{/view}}
<div id="someElementId"></div>