Skip to content

Instantly share code, notes, and snippets.

View fahidmohammad's full-sized avatar
🎯
Focusing

Fahid Mohammad fahidmohammad

🎯
Focusing
View GitHub Profile
@fahidmohammad
fahidmohammad / tewaker.py
Created July 23, 2023 17:42 — forked from scanzy/tewaker.py
Set custom id/class in Streamlit, and inject css/js
import random as rd
import functools as ft
import streamlit as st
import streamlit.components.v1 as components
# Domanda: come applicare stili css solo ad alcuni elementi streamlit?
# Risposta: iniettare js che aggiorni id e classe dell'elemento precedente
@fahidmohammad
fahidmohammad / install-docker.sh
Created June 14, 2023 15:48 — forked from p3jitnath/install-docker.sh
Docker and Nvidia Docker installation in Ubuntu 20.04 LTS
# WARNING : This gist in the current form is a collection of command examples. Please exercise caution where mentioned.
# Docker
sudo apt-get update
sudo apt-get remove docker docker-engine docker.io
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
docker --version
@fahidmohammad
fahidmohammad / index.js
Created February 20, 2018 13:38
Streaming Large file line-by-line - Using Nodejs
var fs = require('fs'),
es = require('event-stream');
var lineNumber = 0;
var s = fs.createReadStream('very-large-file.csv')
.pipe(es.split())
.pipe(es.mapSync(function(line) {
// pause the readstream
s.pause();
@fahidmohammad
fahidmohammad / Gallery.js
Last active February 19, 2018 05:30
Build Gallery From Assets/Local Photo Using - React Native
@fahidmohammad
fahidmohammad / better-nodejs-require-paths.md
Created January 28, 2018 05:58 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@fahidmohammad
fahidmohammad / javascript-plugin-patterns-FOUND-protoytpe-newed.js
Created August 27, 2017 12:59 — forked from mhulse/javascript-plugin-patterns-FOUND-protoytpe-newed.js
Some of my favorite JavaScript plugin design patterns: The Facade Pattern, The Revealing Module Pattern, Immediately-invoked Function Expressions (IIFE)s, The Module Pattern imports and exports
// http://callmenick.com/post/slide-and-push-menus-with-css3-transitions
(function(window) {
'use strict';
/**
* Extend Object helper function.
*/
function extend(a, b) {

SEARCH & DISPLAY

get session from pool

get customer input (departure, destination, dates, passengers count)

# search for recommendations conforming to customer input
do Fare_TravelBoardSearch
@fahidmohammad
fahidmohammad / app.js
Created March 16, 2017 03:29 — forked from Ajido/app.js
nodejs express4 cluster graceful restart / shutdown
...
app.use(function(req, res, next){
if (app.get('graceful_shutdown') === true) {
res.set('Connection', 'close');
}
next();
});
app.set('graceful_shutdown_start', function() {
@fahidmohammad
fahidmohammad / gist:0355104d91070e3b4075
Last active September 10, 2015 04:48
Mongoose populate an array
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;
mongoose.connect('mongodb://localhost/testy2');
var UserSchema = new Schema({
name: String
});
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"