Skip to content

Instantly share code, notes, and snippets.

View gigenthomas's full-sized avatar
🎯
Focusing

Gigen Thomas gigenthomas

🎯
Focusing
View GitHub Profile
@gigenthomas
gigenthomas / app.js
Last active August 29, 2015 13:57 — forked from ggoodman/app.js
var app = angular.module('plunker', ['ngGrid']);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
$scope.fruits = [ 'Apple', 'Orange' ,'Banana'];
$scope.myData = [
{name: "Moroni", age: 50},
@gigenthomas
gigenthomas / schema.sql
Created October 10, 2015 18:10 — forked from fernandomantoan/schema.sql
Schema for PostgreSQL to use with JdbcTokenStore (Spring Security OAuth2)
create table oauth_client_details (
client_id VARCHAR(256) PRIMARY KEY,
resource_ids VARCHAR(256),
client_secret VARCHAR(256),
scope VARCHAR(256),
authorized_grant_types VARCHAR(256),
web_server_redirect_uri VARCHAR(256),
authorities VARCHAR(256),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
@EnableWebMvcSecurity
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private DataSource dataSource;
@Override
protected void configure(HttpSecurity http) throws Exception {
#logging.level.org.springframework.web: DEBUG
logging.level.org.springframework.security=DEBUG
spring.datasource.url=jdbc:h2:mem:AZ;INIT=CREATE SCHEMA IF NOT EXISTS AZ;RUNSCRIPT FROM 'src/main/resources/create.sql';DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.url=jdbc:postgresql://localhost/myDatabase
spring.datasource.username=user
spring.datasource.password=password
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.hbm2ddl.auto=update
spring.jpa.hibernate.ejb.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.hibernate.show_sql=true
spring.jpa.hibernate.format_sql=true
spring.jpa.hibernate.use_sql_comments=false
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.6.RELEASE")
}
}
apply plugin: 'java'
git commit -a -m 'added new benchmarks'
automatically stage every file that is already tracked before doing the commit, letting you skip the git add part:
Rename a file in git
$ git mv file_from file_to
Show a history of commits
$ git log -p -2
user jessed staff;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
@gigenthomas
gigenthomas / api.proxy.server.js
Created December 3, 2015 04:58 — forked from davemo/api.proxy.server.js
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});