Skip to content

Instantly share code, notes, and snippets.

View danishsatkut's full-sized avatar
🏠
Working from home

Danish Aziz Satkut danishsatkut

🏠
Working from home
View GitHub Profile
@danishsatkut
danishsatkut / jquery.masonry.js
Created January 7, 2013 05:32 — forked from stuross/gist:1649731
Masonry jquery script
/**
* jQuery Masonry v2.1.01
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
* http://masonry.desandro.com
*
* Licensed under the MIT license.
* Copyright 2011 David DeSandro
*/
@danishsatkut
danishsatkut / Guardfile
Created June 22, 2013 07:33
A sample guard file for Rails App, contains some code fragments from Rails Tutorial by Michael Hartl.
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'active_support/core_ext'
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
#!/bin/bash
### BEGIN INIT INFO
# Provides: sidekiq beta
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: sidekiq beta - asynchronous rails
@danishsatkut
danishsatkut / movies_top_rated_most_rated.rb
Created October 25, 2013 13:47
English, Hindi top 10 top rated, most rated movies by decades
english_group_id = LanguageCountry.joins(:language).where("language = 'English'").pluck(:group_id).uniq.first
hindi_group_id = LanguageCountry.joins(:language).where("language = 'Hindi'").pluck(:group_id).uniq.first
def write_csv(name, movies)
path = "#{Rails.root.to_s}/log/#{name}.csv"
CSV.open(path, "a+") do |csv|
csv << []
movies.each do |movie|
csv << [movie[:release_year], movie[:engtitle], movie[:cached_avg_rating], movie[:cached_times_rated]]
end
@danishsatkut
danishsatkut / cookie.js
Created October 30, 2013 14:32 — forked from ChillyBwoy/cookie.js
Object oriented Cookie class in JavaScript
@danishsatkut
danishsatkut / capybara cheat sheet.md
Created November 5, 2013 18:36 — forked from zhengjia/capybara cheat sheet
Cheatsheet for capybara

=Navigating= visit('/projects') visit(post_comments_path(post))

=Clicking links and buttons= click_link('id-of-link') click_link('Link Text') click_button('Save') click('Link Text') # Click either a link or a button click('Button Value')

module SphinxHelpers
def index
ThinkingSphinx::Test.index
# Wait for Sphinx to finish loading in the new index files.
sleep 0.25 until index_finished?
end
def index_finished?
Dir[Rails.root.join(ThinkingSphinx::Test.config.searchd_file_path, '*.{new,tmp}.*')].empty?
end
@danishsatkut
danishsatkut / dabblet.css
Created January 18, 2014 08:32
Simple Container Box
.container {
padding: 10px;
background-color: #ADD8E6;
width: 150px;
}
.box-holder {
width: 50px;
height: 50px;
background-color: #EEE;
@danishsatkut
danishsatkut / dabblet.css
Created January 25, 2014 06:39
Image with Username
/**
* Image with Username
*/
@import url('http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css');
#container {
margin-top: 60px;
}