Skip to content

Instantly share code, notes, and snippets.

View Mukesh23singh's full-sized avatar

Mukesh Singh Mukesh23singh

  • Citiustech healthcare technology private limited
  • Mumbai
View GitHub Profile
# no config
Time.now is localtime
1.second.from_now is UTC
Timestamp stored in UTC
AR not translated
Time.now: Fri Aug 24 10:22:25 +0930 2012
1.second.from_now 2012-08-24 00:52:26 UTC
@Mukesh23singh
Mukesh23singh / damerau_levenshtein.rb
Created August 2, 2016 09:32 — forked from dingsdax/damerau_levenshtein.rb
string similarity metrics in ruby
# extension for string class
class String
# return character array of string with indices
def each_char_with_index
i = 0
split(//).each do |c|
yield i, c
i += 1
end
end
@Mukesh23singh
Mukesh23singh / nginx.conf
Created September 8, 2016 14:22 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@Mukesh23singh
Mukesh23singh / promise.any-slim.js
Created February 24, 2017 05:19 — forked from jkjustjoshing/promise.any-slim.js
Promise.any() – A Missing Use Case
Promise.any = function(arrayOfPromises) {
// For each promise that resolves or rejects,
// make them all resolve.
// Record which ones did resolve or reject
var resolvingPromises = arrayOfPromises.map(function(promise) {
return promise.then(function(result) {
return {
resolve: true,
result: result
};
@Mukesh23singh
Mukesh23singh / lambda-dynamo
Created April 15, 2017 10:01 — forked from markusklems/lambda-dynamo
Short aws lambda sample program that puts an item into dynamodb
// create an IAM Lambda role with access to dynamodb
// Launch Lambda in the same region as your dynamodb region
// (here: us-east-1)
// dynamodb table with hash key = user and range key = datetime
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB({apiVersion: '2012-08-10'});
exports.handler = function(event, context) {
@Mukesh23singh
Mukesh23singh / README.md
Created April 28, 2017 11:26 — forked from ChuckBates/README.md
My simply Git Cheatsheet
@Mukesh23singh
Mukesh23singh / gulpfile.js
Created June 11, 2017 12:57 — forked from ktmud/gulpfile.js
An example gulpfile.js with bower components and live reload support
var BatchStream = require('batch-stream2')
var gulp = require('gulp')
var coffee = require('gulp-coffee')
var uglify = require('gulp-uglify')
var cssmin = require('gulp-minify-css')
var bower = require('gulp-bower-files')
var stylus = require('gulp-stylus')
var livereload = require('gulp-livereload')
var include = require('gulp-include')
var concat = require('gulp-concat')
@Mukesh23singh
Mukesh23singh / ShowBox.spec.js
Created August 6, 2017 14:40 — forked from visualskyrim/ShowBox.spec.js
Use Enzyme to test React/Redux container - dispatch
it("should render a text box with no string inside if search string is not provided by store", () => {
const testState = {
showBox: {
search: ""
}
};
const store = createMockStore(testState)
const component = shallowWithStore(<ConnectedShowBox />, store);
component.dive().find("form > div > input").simulate("change", { target: { value: "Site" } });
@Mukesh23singh
Mukesh23singh / ShowBox.jsx
Created August 6, 2017 14:40 — forked from visualskyrim/ShowBox.jsx
Use Enzyme to test React/Redux container - Code List 3
describe('ConnectedShowBox', () => {
it("should render successfully if string is not provided by store", () => {
const testState = {
showBox: {}
};
const store = createMockStore(testState)
const component = shallowWithStore(<ConnectedShowBox />, store);
expect(component).to.be.a('object');
});
});
@Mukesh23singh
Mukesh23singh / ShowBox.jsx
Created August 6, 2017 14:40 — forked from visualskyrim/ShowBox.jsx
Use Enzyme to test React/Redux container - Code List 1
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { submitValue } from '../store/modules/showBox'
export class ShowBox extends React.Component {
constructor(props) {
super(props)
this.state = {
searchString: this.props.search || ""