Skip to content

Instantly share code, notes, and snippets.

View satendra02's full-sized avatar
🏠
Working from home

Satendra Rai satendra02

🏠
Working from home
View GitHub Profile
@satendra02
satendra02 / loadFonts.js
Last active March 26, 2024 14:59
Preload google subsets font
let googleFontUrl = "https://fonts.googleapis.com/css2?family=Rubik:wght@900&family=Roboto:wght@700&family=Josefin+Sans:wght@700&family=Raleway:ital,wght@1,800&family=Inconsolata:wght@400&family=Nunito:wght@400&family=Oswald:wght@400&family=Righteous:wght@400&family=Bitter:wght@700&family=Nunito:wght@700&family=Scheherazade:wght@400&family=Noto+Sans:wght@400&family=Nova+Round:wght@400&family=Lato:wght@400&family=Noto+Sans:wght@700&family=Playfair+Display:wght@700&family=Seymour+One:wght@400&family=Arvo:wght@700&family=Poppins:wght@700&family=Lato:wght@900&family=Open+Sans:wght@400&family=Pacifico:wght@400&family=Josefin+Sans:wght@400&family=Arvo:wght@400&family=Playfair+Display:wght@400&family=Oswald:wght@700&family=Zeyada:wght@400&family=Montserrat+Alternates:wght@600&family=Poppins:wght@400&family=Ubuntu:wght@400&family=Roboto:wght@400&family=Poppins:wght@800&family=Rubik:wght@400&family=Bangers:wght@400&family=Concert+One:wght@400&family=Open+Sans:wght@700&family=Montserrat:wght@800&family=Dancing+Script:w
@satendra02
satendra02 / fabric-toObject.js
Last active February 19, 2018 18:04
Override fabric Object to add custom attribute
//when you export canvas.toJSON(), the object will cointain `your_custom_attribute`
//{“objects”: [{“src”: “”, “your_custom_attribute”: “”, “type”: “image”, …}, {}], “version”: “2.0.0-rc.4” }
fabric.Object.prototype.toObject = (function (toObject) {
return function (propertiesToInclude) {
propertiesToInclude = (propertiesToInclude || []).concat(
['your_custom_attribute', ...]
);
return toObject.apply(this, [propertiesToInclude]);
};
@satendra02
satendra02 / app.DockerFile
Last active March 3, 2024 10:13
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran: