Programming Tips πŸ’‘
51.5K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips πŸ’‘
Articles πŸ“•
Resources πŸ‘Ύ
Design Patterns πŸ’Ž
Software Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
Mocking objects with Moq and XUnit in .NET Core πŸ‘Ύ

This article explains the step by step process that needed to Moq an object in .NET Core ⚜️

Mocking objects comes in handy when unit testing data store, where a Database can be mocked so that no data is added or modified in Database while unit testing source code. ♻️

https://t.me/pgimg/32

[ Tutorial ] : http://bit.do/moqx

γ€°γ€°γ€°γ€°γ€°γ€°
#UnitTest #Mocking #XUnit #Moq
@ProgrammingTip
Yeah, Good jobβ€ΌοΈπŸ˜‚
γ€°γ€°γ€°γ€°γ€°γ€°
#Fun #SoC
@ProgrammingTip
Webpack πŸŒ€

Webpack is a module bundler. πŸ—‚

Its main purpose is to bundle JavaScript files for usage in a browser, it is also capable of transforming, bundling, or packaging. πŸ’Ž

[ Website ] : https://webpack.js.org/

https://t.me/pgimg/34

γ€°γ€°γ€°γ€°γ€°γ€°
#Webpack #Bundler
@ProgrammingTip
Explicit Dependencies Principle ✨

Classes should be honest about what they need to be created. πŸ—£

Methods and classes should explicitly require any collaborating objects they need { typically through method parameters or constructor parameters } in order to function correctly. βœ…

[ Article ] : http://bit.do/expp

https://t.me/pgimg/35
γ€°γ€°γ€°γ€°γ€°γ€°
#Principle
@ProgrammingTip
CSS Variables β€” What You Need to Know 🎨

CSS variables are more accurately described as custom properties.

They are useful in preventing DRY β€” Don’t Repeat Yourself code.

With the ability to change a property once and have that change made all over your style sheet is magical ❗️

[ Article ] : http://bit.do/cvar

γ€°γ€°γ€°γ€°γ€°γ€°
#CSS #Variable
@ProgrammingTip
Hashids πŸ‘Ύ

Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers. πŸ’Ž

It converts numbers like 347 into strings like β€œyr8”, or array of numbers like [27, 986] into β€œ3kTMd”. πŸŒ€

You can also decode those ids back. πŸ”™

Available in πŸ”₯ :
β€’ JavaScript
β€’ .NET
β€’ Java
β€’ PHP
β€’ Ruby
β€’ Python
β€’ Swift
β€’ ...

πŸ”ΈπŸ”ΉπŸ”ΈπŸ”Ή

Usage example in JavaScript πŸ€™πŸ» :

var hashids = new Hashids("this is my salt", 8, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");

var id = hashids.encode(1, 2, 3);
// Output : GlaHquq0

var numbers = hashids.decode(id);
// Output : [1, 2, 3]



https://t.me/pgimg/36

[ Website ] : http://hashids.org/

γ€°γ€°γ€°γ€°γ€°γ€°
#Encode #Hash
@ProgrammingTip
The Art of Comments 🎨

[ Article ] : https://css-tricks.com/the-art-of-comments/

γ€°γ€°γ€°γ€°γ€°γ€°
#CleanCode #Comments
@ProgrammingTip
I β™₯️ Windows ✨

γ€°γ€°γ€°γ€°γ€°γ€°
#OS #Windows
@ProgrammingTip
Deploy ASP.NET Core 2.0 Apps on Heroku ♓️

In this tutorial, we’ll be taking a look at how to deploy web apps built with asp.net core 2.0 to heroku.com, a cloud-hosting platform.

We’ll need a few things πŸ›  :
β€’ Docker (Windows, Mac)
β€’ Heroku CLI (NPM, Binaries)
β€’ ASP.NET Core 2.0 Runtime

https://t.me/pgimg/37

[ Tutorial ] : http://bit.do/aspheroku

γ€°γ€°γ€°γ€°γ€°γ€°
#AspMvc #Core #Heroku
@ProgrammingTip
I β™₯️ Mac OS ✨

γ€°γ€°γ€°γ€°γ€°γ€°
#OS #MacOS
@ProgrammingTip
WAVE ✨

WAVE is tool to help web developers make their web content more accessible. βœ…

WAVE cannot tell you if your web content is accessible. ❌

Only a human can determine true accessibility. πŸ‘₯

But, WAVE can help you evaluate the accessibility of your web content. πŸ‘€

https://t.me/pgimg/38

[ Website ] : http://wave.webaim.org

γ€°γ€°γ€°γ€°γ€°γ€°γ€°γ€°γ€°γ€°γ€°
#FrontEnd #Web #Tools
@ProgrammingTip
Enjoy CSS 🍻

Online CSS3 Code Generator With a Simple Graphical Interface. 🀠

[ Website ] : http://enjoycss.com

γ€°γ€°γ€°γ€°γ€°γ€°
#FrontEnd #Css
@ProgrammingTip
I β™₯️ Linux ✨

γ€°γ€°γ€°γ€°γ€°γ€°
#OS #Linux
@ProgrammingTip
Hollywood Principle ✨

"Don't call us, we'll call you" ☎️ 


Relevant when you are writing a class/component that must fit into the constraints of an existing framework.

You implement the interfaces, you get registered. πŸ‘€

You get called when the time is right. πŸ“ž

πŸ”ΉπŸ”ΈπŸ”ΉπŸ”Έ

By way of an example, a typical ASP.NET Web Form might have in its codebehind page event handlers to respond to Page_Load and Button_Click events. ⚑️

An ASP.NET developer writes code to respond to these external framework events, instead of owning the execution of the web server and making all decisions and method calls accordingly. βœ…

[ Article ] : http://bit.do/holprin

https://t.me/pgimg/39

γ€°γ€°γ€°γ€°γ€°γ€°
#Principle
@ProgrammingTip
Jade-Lang 🐰

Jade is a high performance template engine heavily influenced by Haml and implemented with JavaScript for node and browsers. πŸ’Ž

Syntax :

doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) bar(1 + 5)
body
h1 Jade - node template engine
#container.col
if youAreUsingJade
p You are amazing
else
p Get on it!



Becomes :

<!DOCTYPE html>
<html lang="en">
<head>
<title>Jade</title>
<script type="text/javascript">
if (foo) bar(1 + 5)
</script>
</head>
<body>
<h1>Jade - node template engine</h1>
<div id="container" class="col">
<p>You are amazing</p>
</div>
</body>
</html>



Options ✨ :

πŸ”Έ Compile Debug - If set to true, the function source will be included in the compiled template for better error messages.

πŸ”Ή Add pretty-indentation whitespace to output


https://t.me/pgimg/40

[ Website ] : http://jade-lang.com

[ Npm Package ] : https://www.npmjs.com/package/jade

γ€°γ€°γ€°γ€°γ€°γ€°
#Node #JavaScript #Jade
@ProgrammingTip
Open Graph Protocol 🌐

The Open Graph protocol enables any web page to become a rich object in a social graph. πŸ’Ž

For instance, this is used on Facebook to allow any web page to have the same functionality as any other object on Facebook.

Also, Telegram uses this protocol to preview web pages like a rich object in messages and you can update your links preview using : @WebPageBot βœ…

To turn your web pages into graph objects, you need to add basic metadata to your page ✍🏻 :

og:title
og:type
og:image
og:url


πŸ”ΉπŸ”ΈπŸ”ΉπŸ”Έ

As an example, the following is the Open Graph protocol markup for The Rock on IMDB πŸŽ₯ :

<head>
<title>The Rock (1996)</title>

<meta property="og:title" content="The Rock" />

<meta property="og:type" content="video.movie" />

<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />

<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />

</head>


https://t.me/pgimg/41

[ Website ] : http://ogp.me/

γ€°γ€°γ€°γ€°γ€°γ€°
#OpenGraph #Protocol
@ProgrammingTip
Free SSL Certificates On IIS With LetsEncrypt ⛔️

LetsEncrypt is operated by the Internet Security Research Group (ISRG), and is a Linux Foundation Collaborative Project, which is also responsible for the Linux operating system and Nodejs among other projects. πŸ›ƒ

LetsEncrypt is supported by a range of organisations including Mozilla, Chrome, Akamai and Facebook. πŸ€™πŸ»

The certificates that LetsEncrypt issues are recognised by all major browsers, which results in the familiar padlock symbol being displayed on properly secured sites. πŸ”

This tutorial shows how to use LetsEncrypt with IIS. 🌐

https://t.me/pgimg/42

[ Tutorial ] : http://bit.do/lenc

γ€°γ€°γ€°γ€°γ€°γ€°
#LetsEncrypt #SSL
@ProgrammingTip
Programmers life πŸŒ–

@ProgrammingTip
Visual Studio Shortcut Keys πŸ’¨

Here is a handy reference that can make your .NET lifestyle a bit easier and more productive. πŸ”₯😎

[ Website ] : http://bit.do/vsht

γ€°γ€°γ€°γ€°γ€°γ€°
#VS #Shortcut
@ProgrammingTip
UnCSS ✨

UnCSS is a tool that removes unused CSS from your stylesheets. βœ…

It works across multiple files and supports Javascript-injected CSS. πŸ—‚


Howβ“πŸ€”

1️⃣ The HTML files are loaded by jsdom and JavaScript is executed.

2️⃣ All the stylesheets are parsed by PostCSS.

3️⃣ document.querySelector filters out selectors that are not found in the HTML files.

4️⃣ The remaining rules are converted back to CSS.

https://t.me/pgimg/43

[ Website ] : https://uncss-online.com/

[ Github ] : https://github.com/giakki/uncss

γ€°γ€°γ€°γ€°γ€°γ€°
#FrontEnd #Css #Tools
@ProgrammingTip
SnippetsLab πŸ”¬

SnippetsLab makes it simple to manage all of your valuable code snippets in one place with nested folders, tags, and Smart Groups support. πŸ—‚

You can sort your snippets by date, title, and more. πŸ“…

Features πŸ’Ž :

β€’ Notes and Fragment
β€’ Syntax Highlighting
β€’ Gist Integration
β€’ Sync & Backup

Available for MacOS πŸ’»

https://t.me/pgimg/44

[ Website ] : https://www.renfei.org/snippets-lab

[ AppStore ] : http://bit.do/snplab

γ€°γ€°γ€°γ€°γ€°γ€°
#Tools #MacOS #Snippets
@ProgrammingTip