Skip to content

Instantly share code, notes, and snippets.

//Reverse an input string by maintaining the spaces in the same order as input string.
//For ex:
//Input String : Hello Welcome To DEV Test
//There are spaces at locations - 6 , 14, 17, 21
package com.company;
DECLARE @StartDate DATETIME, @EndDate DATETIME
SET @StartDate = dateadd(mm, -1, getdate())
SET @StartDate = dateadd(dd, datepart(dd, getdate())*-1, @StartDate)
SET @EndDate = dateadd(mm, 1, @StartDate)
SET @CustId = 2
-- hom many orders customer got last month
select count(*) from t_order where t_order.customer_id = @CustId and
order_date BETWEEN @StartDate AND @EndDate;
-- how much $ customer spent last year
package com.company;
/**
* Finder utitilies
*/
public class Finder {
/**
*
* @param smallArray Represents the subset array to be found
{
"page": {
"template": {
"type": "basic",
"name": "template-base",
"version": "2.0.0"
},
"title": "",
"body": {
"content": {
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
@bmakarand2009
bmakarand2009 / HowToSquastGitCommits
Last active July 28, 2017 21:34
Git Procedures
# example merging 4 commits
git checkout mybranch
git rebase -i mybranch~4 mybranch
# at the interactive screen
# choose fixup for commit: 2 / 3 / 4
# use find and replace of vim editor interactively by :%s/pick/f/gc
git push -u origin +mybranch
@bmakarand2009
bmakarand2009 / sample-react-codes
Created July 10, 2017 19:11
ReactJs - Simple Card Component with jscomplete.com/repl
//More Updated Example
//Example - Create a Increment Coutner and Result Component in ReactJs and JsComplete.com/repl
// const Hello = React.createClass({
// render:function() {
// return <button>Hello {this.props.name}</button>;
// }
// });
class Button extends React.Component{
@bmakarand2009
bmakarand2009 / herokoconfig
Created February 15, 2017 18:20
herokuconfig vrs
var express = require("express");
var bodyParser = require('body-parser').json();
var app = express();
var MongoClient = require('mongodb').MongoClient;
var assert = require('assert');
var ObjectId = require('mongodb').ObjectID;
var cron = require('node-cron');
var cronTask = require('./modules/cronConfig/cron')
if(!process.env.MLABURI) var config = require('./config/mongo');
@bmakarand2009
bmakarand2009 / htmlreactinit.html
Last active June 30, 2016 21:18
html-reachjs-starter
<!DOCTYPE html>
<html>
<head>
<title>Flashcard App</title>
<link rel='stylesheet' href='/style.css'>
</head>
<body>
<div id='root'></div>
<script src="https://fb.me/react-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
@bmakarand2009
bmakarand2009 / jsondebug
Created September 23, 2014 21:07
AngularJS JSON Debugging
/* Angular Controller */
Application.controller('TestCtrl',['$scope','$rootScope'function ($scope,$rootScope) {
$scope.userProfile
}
/* HTML5 Side */
<div ng-controller='TestCtrl'>
<pre {{userProfile | json}}>
</div>