This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose =require('mongoose'); | |
const Schema = mongoose.Schema; | |
const CounterSchema = require('./counter'); | |
const LinkSchema = new Schema({ | |
_id: { type: Number }, | |
url: { type: String, required: true } | |
}, { | |
timestamps: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |