Skip to content

Instantly share code, notes, and snippets.

View svlasov's full-sized avatar

Sergey Vlasov svlasov

  • Israel
View GitHub Profile
@svlasov
svlasov / dabblet.css
Created December 17, 2012 13:29
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.container {
width: 500px;
background-color: yellow;
margin-top: 100px;
position: relative;
}
@svlasov
svlasov / dynamic-load.html
Last active December 12, 2015 08:29
Async script loading
<!-- dynamic async loading -->
<script type="text/javascript">
(function(src){
var po = document.createEkement('script');
po.type = 'text/javascript';
po.async = true; //VERY IMPORTANT!!!
po.src = src;
var s = document.getElementsBytagName('script')[0];
s.parentNode.insertBefore(po, s);
})("https://apis.google.com/js/plusone.js");
@svlasov
svlasov / _login_items.html.erb
Last active December 12, 2015 09:19
Devise menu items
<% if user_signed_in? %>
<li>
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
</li>
<% else %>
<li>
<%= link_to('Login', new_user_session_path) %>
</li>
<% end %>
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@svlasov
svlasov / Gemfile
Created March 8, 2013 23:53
Setup database cleaner in Rails app
group :test do
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'capybara'
gem 'factory_girl_rails'
gem 'database_cleaner'
gem 'jasmine'
end
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@svlasov
svlasov / users.yml
Created September 4, 2013 12:46 — forked from henrydjacob/users.yml
user1:
email: [email protected]
encrypted_password: <%= User.new.send(:password_digest, "user123") %>
confirmed_at: <%= Time.now %>
@svlasov
svlasov / Gemfile
Created October 25, 2013 07:34 — forked from flomotlik/Gemfile
gem 'foreman'
gem 'puma'
@svlasov
svlasov / .railsrc
Created March 22, 2014 10:29
New Rails 4 application setup
# ~/.bashrc
--skip-bundle
--skip-test
--database postgresql
@svlasov
svlasov / gist:e9933a6316b2672cfe16
Created May 18, 2014 11:35
check if a directory exists and create it if necessary
if not os.path.exists(directory):
os.makedirs(directory)