Skip to content

Instantly share code, notes, and snippets.

View logicware's full-sized avatar

Matloob ul Hasan logicware

View GitHub Profile
import React, { useState, useEffect, useContext, useRef } from "react";
import { UserContext } from "../../../Contexts/UserContext";
import { FaTrash } from "react-icons/fa";
import "./UpdateUserInfoModal.css";
import { FaUserCircle } from "react-icons/fa";
import useOutsideClick from "../../../CustomHooks/useOutsideClick";
import Axios from "axios";
import sdk from 'matrix-js-sdk';
const matrixClient = sdk.createClient({
baseUrl: process.env.MATRIX_BASE_URL, // https://programination.modular.im
});
async register(req, res) {
let sessionId = null;
const auth = { type: 'm.login.dummy' };
const name = 'matloob-new';
const password = 'testing';
@logicware
logicware / gist:11299767
Created April 25, 2014 19:05
Aggregation Query - MongoDB 2.4.9
var mongoose = require('mongoose');
var dbURL = "mongodb://localhost:27017/test";
mongoose.connect(dbURL);
var Schema = mongoose.Schema;
ProductSchema = new Schema({
birthdate: { type: Date, default: Date.now },
purchase_date: { type: Date, default: Date.now },
@logicware
logicware / javascript_resources.md
Created December 20, 2013 11:45 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@logicware
logicware / group.js
Last active December 23, 2015 20:19
Mongoose Model and Route handler for the same (REST API).
/**
* Created with JetBrains WebStorm.
* User: Matloob
* Date: 9/12/13
* Time: 12:06 PM
* To change this template use File | Settings | File Templates.
*/
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
@logicware
logicware / tests.js
Created September 24, 2013 12:05
Examples of tests created with mocha/should for a node.js server for an app based on xWiki.
describe('Testing createBlogPost', function(){
it('Should Create Blog Post and return code=2', function(done){
request.post({url:baseURL + "/api/createBlogPost", json:true,body:JSON.stringify({blogPostName:blogPostName, blogPostTitle:blogPostTitle, blogPostContent:blogPostContent})},
function(error,resp,body){
body.code.should.equal(2); // is already there, will return 1
done();
}