Skip to content

Instantly share code, notes, and snippets.

View shortthirdman's full-sized avatar
🎯
Focusing

Swetank Mohanty shortthirdman

🎯
Focusing
View GitHub Profile
@shortthirdman
shortthirdman / context.xml
Created May 12, 2017 10:01
[JAVA] Maven Web Application Context settings for DB connection
<Context>
<!-- maxTotal: Maximum number of database connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to -1 for no limit.
-->
<!-- maxIdle: Maximum number of idle database connections to retain in pool.
Set to -1 for no limit. See also the DBCP documentation on this
and the minEvictableIdleTimeMillis configuration parameter.
-->
@shortthirdman
shortthirdman / web.xml
Created May 12, 2017 10:07
[JAVA] Maven Web App J2EE Deployment descriptor
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>MySQL Test App</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
@shortthirdman
shortthirdman / ReschedulingDailyTask.java
Created May 12, 2017 10:10
[JAVA] Rescheduling Tasks
import java.util.Calendar;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class ReschedulingDailyTask implements Runnable {
@shortthirdman
shortthirdman / authProvider.js
Created June 3, 2017 08:15
Authentication Provider to Social Networking Site for Sign-In/Sign-Up
$authProvider.httpInterceptor = function() { return true; },
$authProvider.withCredentials = false;
$authProvider.tokenRoot = null;
$authProvider.baseUrl = '/';
$authProvider.loginUrl = '/auth/login';
$authProvider.signupUrl = '/auth/signup';
$authProvider.unlinkUrl = '/auth/unlink/';
$authProvider.tokenName = 'token';
$authProvider.tokenPrefix = 'satellizer';
$authProvider.tokenHeader = 'Authorization';
@shortthirdman
shortthirdman / mock-server.js
Created June 3, 2017 08:17
EmberJS HTTP-Mock Server for Authentication
var server = new Pretender(function() {
this.post('/session', function(request) {
switch(request.requestBody) {
case 'username=admin&password=secret':
return [201, {'Content-Type': 'application/json'}, '{"token":"admin","user":{"role":"admin","name":"Administrator"}}'];
case 'username=user&password=secret':
return [201, {'Content-Type': 'application/json'}, '{"token":"user","user":{"role":"user","name":"User"}}'];
default:
@shortthirdman
shortthirdman / auth-api.js
Created June 3, 2017 08:19
EmberJS Authentication using HTTP/XHR Requests and Response
var API = {
token: null,
login: function(username, password) {
var self = this;
var payload = {
username: username,
password: password
};
@shortthirdman
shortthirdman / tsconfig.json
Created June 3, 2017 09:18
TSConfig for Angular 2 and Angular 4 TypeScript
{
"compileOnSave": false,
"compilerOptions": {
"target": "es5",
"module": "system",
"declaration": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,

Set email and name globally

  • git config --global user.name "Swetank Mohanty"
  • git config --global user.email "swetank.mohanty@gmail.com"

Verify email and name globally

Generate SSH Key-Pair (RSA)

@shortthirdman
shortthirdman / maven-cli.md
Last active December 10, 2017 12:00
Maven CLI Commands

Create Web Project from Maven Template

mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -Dversion={project-version} -Dpackage={project-packaging} -DinteractiveMode=false

Create a Project from Maven Template

mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-quickstart -Dversion={project-version} -Dpackage={project-packaging} -DinteractiveMode=false

@shortthirdman
shortthirdman / waiting-dots.html
Created August 11, 2017 10:10
Loading Waiting dots using CSS 3
<div class="waiting-dots">
Loading Application<span>.</span><span>.</span><span>.</span>
</div>
<style>
@keyframes blink {
/**
* At the start of the animation the dot
* has an opacity of .2
*/
0% {