Skip to content

Instantly share code, notes, and snippets.

Dimitry Nazarov dimanyc

  • thoughtbot
  • Brooklyn, NY
Block or report user

Report or block dimanyc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@delameko
delameko / upgrade-postgres-9.5-to-9.6.md
Last active Sep 26, 2019 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04
View upgrade-postgres-9.5-to-9.6.md

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
@alex-safian
alex-safian / SassMeister-input.scss
Created Oct 29, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
@mixin ul-style ()
{
ul{
list-style-type:none;
li{
color:red;
@DannyDelott
DannyDelott / getTimeLeft().js
Last active Jul 6, 2019
Show time left until noon using Moment.js
View getTimeLeft().js
var getTimeLeft = function(){
var now = moment();
var deadline = now.clone().hour(12).minute(0),second(0);
if(now.isAfter(deadline) {
// disable RSVP button here
return ‘Closed’;
}else {
// enable RSVP button here
// returns “in x hours”, “in x minutes”, “in a few seconds”
return deadline.from(now);
@bartoszkopinski
bartoszkopinski / find_vs_where_benchmark.rb
Last active May 8, 2016
Mongoid benchmark, #find vs. #where, #only vs. no #only
View find_vs_where_benchmark.rb
n = 1_000
id = User.first.id
profile = User.only(:profile).find(id).profile
Benchmark.bm(50) do |x|
x.report('User.find(id).profile') do
n.times{ User.find(id).profile }
end
@PierreMage
PierreMage / PowerShell-profile.ps1
Last active Sep 16, 2019
Make your Windows command line better with doskey
View PowerShell-profile.ps1
# http://technet.microsoft.com/en-us/library/ee692685.aspx
# F7 = history
# Alt+F7 = history -c
# F8 = Ctrl+R
Set-Location C:
# Easier navigation
Set-Alias o start
function oo {start .}
@zealot128
zealot128 / crawler.rb
Last active Aug 15, 2018
Web Crawler Helper class based upon Poltergeist (PhantomJS).Using Capybara as framework for building webcrawlers is surprisingly convenient
View crawler.rb
class ExampleCrawler < PoltergeistCrawler
def crawl
visit "https://news.ycombinator.com/"
click_on "More"
page.evaluate_script("window.location = '/'")
end
end
ExampleCrawler.new.crawl
@kyletcarlson
kyletcarlson / rspec_model_testing_template.rb
Last active Oct 17, 2019
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@p1nox
p1nox / postgresql_configuration_on_ubuntu_for_rails.md
Last active Oct 16, 2019
PostgreSQL configuration without password on Ubuntu for Rails
View postgresql_configuration_on_ubuntu_for_rails.md

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
@jareware
jareware / SCSS.md
Last active Oct 17, 2019
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do
View SCSS.md

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@metaskills
metaskills / gist:4065702
Last active Sep 2, 2016
Example Of Other/Legacy DB Connection Management & Query Cache
View gist:4065702
# Assuming you champioin your other DB connection with a class.
module OtherDb
class Connection < ActiveRecord::Base
establish_connection :other_db
self.abstract_class = true
end
end
# Alway use the connection for other/legacy connections.
You can’t perform that action at this time.