Skip to content

Instantly share code, notes, and snippets.

View solancer's full-sized avatar
🎯
Focusing

Srinivas Gowda solancer

🎯
Focusing
View GitHub Profile
@solancer
solancer / htaccess.expires.headers
Created December 13, 2016 21:01
htaccess expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
@solancer
solancer / apache-nginx-ftp
Created July 27, 2016 10:53
Correct permissions for /var/www/html
// Adding current user to www-data
sudo adduser $USER www-data
//change ownership to user:www-data and
sudo chown $USER:www-data -R /var/www/html
sudo chmod u=rwX,g=srX,o=rX -R /var/www/html
// change file permissions of existing files and folders to 755/644
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;
@solancer
solancer / webProjectv3.txt
Created January 25, 2024 15:21
webProjectv3 tree2dir test
webProjectv3/
├── LICENSE.md
├── README.md
├── archetypes
│ └── default.md
├── docker-compose.yml
├── gulpfile.js
├── layouts
│ ├── 404.html
│ ├── blog
@solancer
solancer / project-tree.txt
Created January 23, 2024 13:28
project-tree.txt
project/
├── src
│ ├── controllers
│ │ └── yourController.js
│ ├── models
│ │ └── yourModel.js
│ ├── routes
│ │ └── yourRoute.js
│ ├── utils
│ │ └── database.js
@solancer
solancer / droplet-proxy.sh
Created April 14, 2016 13:16
Proxy Server on Digitalocean Droplet
#!/usr/bin/env bash
# How to start:
# 1. Sign up for DigitalOcean with this link https://www.digitalocean.com/
# 2. Go to https://cloud.digitalocean.com/settings/applications and find you API key
# 3. In your shell, run 'export DIGITALOCEAN_TOKEN="INSERT TOKEN HERE"', without the outer quotes.
# 4. `brew install jq`
# 5. `./digitalocean-proxy`
# 6. When you are done, press CTRL+C ONCE, and everything will be cleaned up.
webApp/
├── package.json
├── app/
│ ├── app.js
│ ├── views/
│ │ ├── home.html
│ │ └── about.html
│ └── models/
│ ├── user.js
│ └── product.js
@solancer
solancer / mod_pagespeed .htaccess
Last active January 11, 2023 07:25
mod_pagespeed .htaccess configuration
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@solancer
solancer / ReactConditionalRendering.js
Created December 9, 2022 07:14
React conditional rendering
export const RenderIf = ({ children, when }) => {
return when ? children : null
}
import RenderIf from '../components/RenderIf'
let userLoggedIn = false
<RenderIf when={userLoggedIn}>
<UserProfile />
@solancer
solancer / npmVersion.md
Created August 8, 2022 11:34 — forked from nmccready/npmVersion.md
npm version described

npm version

read https://docs.npmjs.com/cli/version it's very straight forward.

Everything in npm config cli is available to be set in .npmrc like preid.

IE this allows your to define your prerelease identifier. By default npm follows this format.

MAJOR.MINOR.PATCH-PRE

@solancer
solancer / usage.py
Created July 1, 2022 03:08
Django / Python Entity or ID Pattern
def my_fun(user_or_id: UserOrId):
user = get_user(user_or_id)
# Do something with user
# These both do the same thing (but the first avoids the extra db hit)
my_fun(user)
my_fun(user.id)