Skip to content

Instantly share code, notes, and snippets.

Mohamad Atie MohamadAtieh

Block or report user

Report or block MohamadAtieh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MohamadAtieh
MohamadAtieh / PreferenceManager.java
Created Sep 20, 2015
Shared preference manager
View PreferenceManager.java
package com.matie.redgram.data.managers.preferences.main;
import android.content.Context;
import android.content.SharedPreferences;
/**
* Created by matie on 20/09/15.
*
* Singleton manager
*/
View index.js
const express = require('express');
const router = express.Router();
const mainController = require('../controllers');
const pj = require('../package.json');
/* GET home page. */
router.get('/', (req, res) => {
res.status(200).json({ name: pj.name, version: pj.version});
});
View counter.js
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const CounterSchema = new Schema({
_id: { type: String, required: true },
count: { type: Number, default: 0 }
}, {
timestamps: true,
collection: 'counters'
});
View link.js
View controller.js
const LinkSchema = require('../models/link');
const isUrl = require('../node_modules/validator/lib/isURL');
const alphabets = '23456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ-_',
base = alphabets.length;
/**
* Saves the link to the database and returns a shortened one
*
* @param req URL to save and shorten
@MohamadAtieh
MohamadAtieh / AccountAuthenticator.java
Created Feb 22, 2016 — forked from burgalon/AccountAuthenticator.java
Implementing OAuth2 with AccountManager, Retrofit and Dagger
View AccountAuthenticator.java
public class AccountAuthenticator extends AbstractAccountAuthenticator {
private final Context context;
@Inject @ClientId String clientId;
@Inject @ClientSecret String clientSecret;
@Inject ApiService apiService;
public AccountAuthenticator(Context context) {
super(context);
View MainClass.java
public class MainClass {
public static void main(String args[]){
String sampleData = "1-2,2-3,3-4,9-0,0-9,2-4,5-6,9-0,8-9,9-8,1-9,1-3,1-10,10-13,11-12,12-15,15-19,19-22,20-22,21-20,18-20,1-20,1-19,1-9,20-21,21-22,22-0,1-22,9-20,9-23,19-8,2-18,7-21,2-21,21-3";
// String sampleData2 = "3-4,4-9,8-0,2-3,5-6,2-9,5-9,7-3,4-8,5-6,0-2,6-1,6-1,0-2,5-6,4-8,7-3,5-9,2-9,5-6,2-3,8-0,4-9,3-4";
// String sampleData3 = "3-4,4-9,8-0,2-3,5-6,2-9,5-9,7-3,4-8,5-6,0-2,6-1,3-4,4-9,8-0,2-3,5-6,0-2,5-9,7-3,4-8,5-6,2-9,6-1,3-4,4-9,8-0,2-3,5-6,2-9,5-9,7-3,4-8,5-6,0-2,6-1";
ProblemMatrix matrix = new ProblemMatrix(new boolean[50][50]);
matrix.setUpMatrix();
View index.html
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.css'>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='//d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/nvd3/1.1.15-beta/nv.d3.min.js' type='text/javascript'></script>
<script src='//nvd3.org/assets/lib/fisheye.js' type='text/javascript'></script>
You can’t perform that action at this time.