Skip to content

Instantly share code, notes, and snippets.

View jittdev's full-sized avatar

Subrosa Games LLC jittdev

View GitHub Profile
@jittdev
jittdev / DisableSshLoginOnServer(OnlyUseKeys)1.sh
Created March 14, 2023 13:59
disable ssh login on server (only use keys) :: #shell
Login as root to your Linux server using key based authentication. Use an editor like Nano or Vim to edit the following file:
/etc/ssh/sshd_config
Find the following line:
PasswordAuthentication yes
And change it to:
PasswordAuthentication no
If there is a # (means commented out) at the beginning of that line, remove it.
@jittdev
jittdev / ResponsiveScreenWidthTag1.html
Created March 14, 2023 13:59
responsive screen width tag :: #HTML
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
@jittdev
jittdev / App.Js1.txt
Created March 14, 2023 13:59
app.js :: #VUE
import Vue from 'vue';
const Api = require('./api/);
document.addEventListener("DOMContentLoaded", () => {
var app = new Vue({
el: '#app',
components: {
'task': {
@jittdev
jittdev / UnsignedIntegers1.cpp
Created March 14, 2023 13:59
unsigned integers :: #C++
unsigned int b = 8; // can't represent negative numbers
int a = 7;
@jittdev
jittdev / ForLooping1.py
Created March 14, 2023 13:59
for looping :: #Python Basics
for blah in 'Zero to Mastery':
print(blah)
#output
Z
e
r
o
t
@jittdev
jittdev / Uialert1.m
Created March 14, 2023 13:59
UIAlert :: #Objective-C
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Title"
message:[NSString stringWithFormat:@"Message"]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* okButton = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
@jittdev
jittdev / Map()1.py
Created March 14, 2023 13:58
map() :: #Python Advanced
# map(action, [1,2,3])
def multiply_by2(item):
return item*2
print(list(map(multiply_by2, [1,2,3])))
my_pets = ['sisi', 'bibi', 'titi', 'carla']
def capatilze(name):
@jittdev
jittdev / TemplateType1.txt
Created March 14, 2023 13:58
Template Type :: #C++
Whereas a class needs to explicitly identify the type, a templated function does not need to explicitly identify the type(s) used if the type of its arguments can be sufficiently matched to the templated types used in the function declaration.
std::vector<char>
std::vector<int>
std::vector<uiuc::Cube>
vectors are part of the standard library for arrays
defined in: #include <vector>
initialization: std::vector<Type> v;
@jittdev
jittdev / DeviseMailerSetttings1.rb
Created March 14, 2023 13:58
devise mailer setttings :: #Ruby / Rails
config.action_controller.allow_forgery_protection = false
config.action_mailer.default_url_options = { :host => 'DOMAIN.COM' }
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:authentication => :login,
@jittdev
jittdev / TernaryOperatorConditionalOperator1.ts
Created March 14, 2023 13:58
ternary operator / conditional operator :: #C++
[Boolean-valued condition] ? [expression to evaluate if true] : [expression to evaluate if false]
So, you could compare "A ? B : C" to "if (A) {B;} else {C;}" but that the ternary operator is allowed in situations where "if" is not allowed. This is because "?:" is evaluated at the level of an expression, so it can be a sub-expression within a larger expression, whereas the "if" statement is a top-level flow control statement that can't be nested within an expression. This means that you can put ?: to the right of an assignment = operator, which you cannot do with an "if". Here is an example:
// Since (5<10) is true, the expression before the colon will be selected, which is 1.
int x = 5 < 10 ? 1 : 2;
// Now x is equal to 1.
// Note, the following syntax is NOT allowed in C++, which is why the ternary operator can be useful in these cases:
int y = if (5<10) {1;} else {2;}