Skip to content

Instantly share code, notes, and snippets.

View foysalit's full-sized avatar
🎯
Focusing

Foysal Ahamed foysalit

🎯
Focusing
View GitHub Profile
@foysalit
foysalit / index.js
Created August 20, 2019 14:02
Sequelize Cross database join example
const Sequelize = require('sequelize');
const sequelizeConfig = {
username: "root",
password: "admin",
dialect: "mysql"
};
const userDb = new Sequelize({...sequelizeConfig, database: 'sequelize_test_users'});
const contentDb = new Sequelize({...sequelizeConfig, database: 'sequelize_test_contents'});
var http = require('http');
var fs = require('fs');
//server creation
var server = http.createServer(function(req,res){
console.log("request was made: " + req.url);
//creating routing system for the server
var routeToFile = {
@foysalit
foysalit / file_1.js
Created February 2, 2017 17:58
sync->async for John Heeter's codementor task
const exec = require('child_process').exec
const spawn = require('child_process').spawn
const dockerMachine = require('dockermachine')
machine = {
cmd(cmd, cb) {
return exec('docker-machine ' + cmd, (error, output) => {
if (error) {
console.log("something Broke:" + error)
return "something Broke: " + error
@foysalit
foysalit / gtt.js
Created September 10, 2016 20:48
gtt bus time table parser with cheerio and meteor
import { HTTP } from 'meteor/http';
import { load as loadPage } from 'cheerio';
const url = `http://www.gtt.to.it/cms/percorari/arrivi`;
Meteor.methods({
getArrivals: function(stopNumber) {
let data = [];
let page = HTTP.call('GET', url, {params: {
palina: stopNumber,
Verifying that "foysalit.id" is my Blockstack ID. https://onename.com/foysalit
@foysalit
foysalit / setup.sh
Created March 31, 2016 15:27
create new heroku app
heroku accounts:add account_name --auto
ssh-keygen -t rsa -C "emailaddresshere"
# add the ssh config file with heroku config to ~/.ssh/config file
Host heroku.com
HostName heroku.com
IdentityFile home/username/.ssh/identity.heroku.account_name
IdentitiesOnly yes
#set new account as current
@foysalit
foysalit / parser.js
Last active February 18, 2016 12:07
polito libretto parser.
(function() {
var $table = jQuery('#portlet_container').find('.col-md-12').eq(6).find('table');
var $rows = $table.find('tr');
var Data = [];
function buildDate (date) {
var parts = date.split("/");
var dt = new Date(parseInt(parts[2], 10),
parseInt(parts[1], 10) - 1,
parseInt(parts[0], 10));
@foysalit
foysalit / tpl.js
Last active November 29, 2015 14:18
meteor template level subscription
function showSpinner() {
console.log('showing spinner');
}
function hideSpinner() {
console.log('hiding spinner');
}
Template.Tpl.onRendered(function(){
showSpinner();
@foysalit
foysalit / Company.php
Last active August 29, 2015 14:16
query eloquent relation
public function users()
{
return $this->hasMany('App\User');
}
public function tasks()
{
return $this->hasMany('App\Task');
}
@foysalit
foysalit / dashboard_functions.php
Last active February 12, 2017 05:36
bdgeeks wp dashboard extension
<?php
/**
* class to customize dashboard of users
*/
class CFA_dashboard{
public $user_data;
public $username;
public function __construct()
{