Skip to content

Instantly share code, notes, and snippets.

@kadru
kadru / media-query.css
Created July 3, 2018 00:44 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@kadru
kadru / expressjs_with_godaddy_certs.md
Created July 6, 2018 23:21 — forked from nanusdad/expressjs_with_godaddy_certs.md
Express JS with GoDaddy SSL Certificates

How to use GoDaddy SSL certs with Express JS

  • Node requires each certificate in the CA chain to be passed separately in an array.
  • GoDaddy provides a cerficate file (gd_bundle.crt) probably looks like this:
-----BEGIN CERTIFICATE-----
MIIE3jCCA...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
@kadru
kadru / autofix_and_other_utilities_sql_server.sql
Last active January 28, 2019 15:56
autofix and other utilities sql server.sql
EXEC sp_change_users_login 'Auto_Fix', 'user', NULL, 'pass'
-- constraints information
SELECT * FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
SELECT *
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
where CONSTRAINT_NAME = 'constraint_name'
#With the macOS El capitan
#check git version
git --version
#Backup (or remove) Apple git (Optional)
sudo mv /usr/bin/git /usr/bin/git-apple
#Install Homebrew if you didn’t have
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#Or update if you already have
brew update && brew upgrade
#Install Git with Homebrew
@kadru
kadru / singleton.rb
Created September 6, 2018 14:59 — forked from mssola/singleton.rb
Different ways to create the Singleton pattern in Ruby.
##
# This files shows some possible implementations of the Singleton pattern
# in Ruby. I'm not a huge fan of the Singleton pattern, but it's nice
# in some cases. In this file I'm going to implement a simple logger.
#
##
# The first implementation that can come to our minds is to create a class
# that holds an instance as a class variable that can be accessed through
@kadru
kadru / stored_procedure_service.rb
Last active September 14, 2018 18:22 — forked from ys/stored_procedure_service.rb
Execute stored procedure
class DatabaseHelper
def self.select name, *args, &blk
execute "select", name, *args, &blk
end
def self.call name, *args, &blk
execute "call", name, *args, &blk
end
def self.execute via, name, *args, &blk
@kadru
kadru / data_type_columns.sql
Last active November 14, 2018 21:02
sql meta queries
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = 'yourTableName'
COLUMN_NAME = 'yourColumnName'
@kadru
kadru / strategy_pattern.rb
Created October 14, 2018 18:58
strategy pattern dynamic behavior example
module RunStrategies
class RunStrategyInterface
def self.run(name)
raise "Run method has not been implemented!"
end
end
class Jog < RunStrategyInterface
def self.run(name)
puts "#{name} is now jogging at a comfortable pace."
@kadru
kadru / webpacker_rails.md
Created October 15, 2018 04:41 — forked from maxivak/webpacker_rails.md
Webpack, Yarn, Npm in Rails
@kadru
kadru / private_public_protected_example.rb
Created October 19, 2018 02:01
Explain ruby protected, private and public methods
#dwarf.rb
class Dwarf
include Comparable
def initialize(name, age, beard_strength)
@name = name
@age = age
@beard_strength = beard_strength
end