Skip to content

Instantly share code, notes, and snippets.

View AnatoliiD's full-sized avatar
🇺🇦

Anatolii Didukh AnatoliiD

🇺🇦
  • Norway, Jørpeland
View GitHub Profile
@luismts
luismts / GitCommitBestPractices.md
Last active November 14, 2024 08:28
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@Ptico
Ptico / gems.rb
Created October 6, 2015 14:42
My default rails gemfile
source 'https://rubygems.org'
BUNDLE_RAILS_VERSION = '~> 4.2.4'
# Rails
gem 'railties', BUNDLE_RAILS_VERSION
gem 'activesupport', BUNDLE_RAILS_VERSION
gem 'actionpack', BUNDLE_RAILS_VERSION
gem 'actionmailer', BUNDLE_RAILS_VERSION
gem 'activejob', BUNDLE_RAILS_VERSION
@ipedrazas
ipedrazas / gist:6d6c31144636d586dcc3
Last active July 10, 2023 16:24
Nginx ssl config

The process starts by creating the CSR and the private key:

openssl req -nodes -newkey rsa:2048 -nodes -keyout dotmarks.net.key -out dotmarks.net.csr -subj "/C=GB/ST=London/L=London/O=dotmarks/OU=IT/CN=dotmarks.net"

Generates

  • dotmarks.net.key
  • dotmarks.net.csr
@jodosha
jodosha / lotus_model.rb
Last active October 13, 2016 10:33
Full working example of Lotus::Model
require 'bundler/setup'
require 'lotus/model'
require 'lotus/model/adapters/sql_adapter'
require 'sqlite3'
connection_uri = "sqlite://#{ __dir__ }/test.db"
database = Sequel.connect(connection_uri)
database.create_table! :articles do
primary_key :id
@maccman
maccman / counter.sql
Created July 7, 2013 03:11
Postgres counter cache using triggers.
--
-- Name: c_posts_voted(); Type: FUNCTION; Schema: public; Owner: -
--
CREATE FUNCTION c_posts_voted() RETURNS trigger
LANGUAGE plpgsql
AS $$ BEGIN
UPDATE "posts" SET voted_user_ids = array_append(voted_user_ids, NEW.user_id) WHERE "id" = NEW.post_id;
RETURN NEW;
END;
@weidenfreak
weidenfreak / gist:3987288
Created October 31, 2012 14:21
Timecop and milliseconds
#
# freezing DateTime.now
#
# in Rails
$ rails c
Loading development environment (Rails 3.2.8)
# DateTime and Time have milliseconds before freezing time
>> DateTime.now.iso8601 9
@saetia
saetia / gist:1623487
Last active July 16, 2024 05:56
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@phollyer
phollyer / spreadsheet_test
Created September 13, 2011 17:43
Spreadsheet Gem - updating an existing sheet without changing the output location or filename
#!/usr/bin/env ruby
require 'spreadsheet'
# Begin Test
print "Spreadsheet Test\n"
# Create the rows to be inserted
row_1 = ['A1', 'B1']
row_2 = ['A2', 'B2']