Skip to content

Instantly share code, notes, and snippets.

View sseletskyy's full-sized avatar
🍊
FP mood

Sergiy Seletskyy sseletskyy

🍊
FP mood
View GitHub Profile
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=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')
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 31, 2024 22:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Ivor
Ivor / Fixing missing hstore extension for postgres and rails.
Created February 16, 2013 08:43
I kept running into "PG::Error: ERROR: type "hstore" does not exist" because we had neglected to add hstore to our database and my migrations would constantly fail. Here are the steps to fix this problem:
HSTORE PROBLEMS:
If the specs are not running because you are running into hstore issues:
1. In the postgresql console:
update pg_database set datallowconn = TRUE where datname = 'template0';
This allows you to edit your postgresql default database template.
2. In your shell:
@jphenow
jphenow / deploy.rake
Last active December 18, 2015 00:09 — forked from njvitto/deploy.rake
#Deploy and rollback on Heroku in staging and production
%w[staging production].each do |app|
desc "Deploy to #{app}"
task "deploy:#{app}" => %W[deploy:set_#{app}_app deploy:push deploy:restart deploy:tag]
desc "Deploy #{app} with migrations"
task "deploy:#{app}:migrations" => %W[deploy:set_#{app}_app deploy:push deploy:off deploy:migrate deploy:restart deploy:on deploy:tag]
desc "Rollback staging"
@kenguest
kenguest / ArrayAsAsciiTable.php
Created July 31, 2013 17:28
Ordinarily, I would suggest use of PEAR's Console_Table package, this is just an example solution for the first test suggested at http://phpixie.com/blog/test-tasks-for-php-interviews-that-developers-will-enjoy-solving/
<?php
/**
* ArrayAsAcsiiTable.php
* 31-Jul-2013
*
* Ordinarily, I would suggest use of PEAR's Console_Table package, this
* is just an example solution for the first test suggested at
* http://phpixie.com/blog/test-tasks-for-php-interviews-that-developers-will-enjoy-solving/
*
* PHP Version 5
@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
@piranha
piranha / пше
Last active March 25, 2023 07:41
пше гит, прошу пана
#!/usr/bin/env python
# -*- mode: python, coding: utf-8 -*-
#
# This incredible piece of code makes git a bit Polish, a bit Western Ukrainian,
# пше прошу пана
# Joke is based on fact that 'git' is 'пше' in qwerty/йцукен layouts
#
# (c) 2013 Alexander Solovyov under terms of WTFPL
import sys
@sseletskyy
sseletskyy / update_sequences.sql
Created December 4, 2013 14:28
UPDATE ALL SEQUENCES
--This is a handy PostreSQL script to fix sequences for all tables at once
SELECT 'SELECT SETVAL(' ||quote_literal(quote_ident(S.relname))|| ', MAX(' ||quote_ident(C.attname)|| ') ) FROM ' ||quote_ident(T.relname)|| ';'
FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C
WHERE S.relkind = 'S'
AND S.oid = D.objid
AND D.refobjid = T.oid
AND D.refobjid = C.attrelid
AND D.refobjsubid = C.attnum
ORDER BY S.relname;
@warnergodfrey
warnergodfrey / Gemfile
Last active December 14, 2017 01:10
Instructions for running remote JMeter
source 'https://rubygems.org'
gem 'ruby-jmeter', github: 'lukeck/ruby-jmeter'