Skip to content

Instantly share code, notes, and snippets.

View sumitk's full-sized avatar
🎯
Focusing

Sumit Kataria sumitk

🎯
Focusing
View GitHub Profile
@sumitk
sumitk / nginx-tuning.md
Created September 26, 2021 10:05 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@sumitk
sumitk / hide_untranslated.php
Created July 8, 2020 06:30 — forked from filipengberg/hide_untranslated.php
Drupal 8 module that hides entities that has no translation in the currently viewed language. Also redirects untranslated node views to frontpage
<?php
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Url;
/**
@sumitk
sumitk / MultiSelectFiltersApplication
Last active July 29, 2019 11:05 — forked from stomg7969/fianlMultiFilter.js
FILTER BLOG - multi filter
https://medium.com/better-programming/creating-a-multi-filter-function-to-filter-out-multiple-attributes-javascript-react-rails-5aad8e272142
const category = ['innerwear', 'dress', 'robe', 'pajamas', 'sweater', 'pants'];
const color = ['white', 'black', 'brown', 'navy', 'blue', 'yellow', 'pink', 'purple', 'beige', 'red', 'green'];
const gender = ['unisex', 'girl', 'boy'];
const material = ['modal', 'cotton', 'spandex', 'tencel', 'rayon'];
const collectedTrueKeys = {
color: ['white', 'pink'],
gender: ['girl'],
angular.module('myApp.services', ['ngResource'])
.factory('TestingService', ['$resource', function($resource) {
return $resource('/api/v1/values', {}, {
getValues: {
method: 'GET'
}
});
}]);
angular.module('app.resources', ['ngResource'])
.factory('api', function ($resource) {
var api = {
defaultConfig : {id: '@id'},
extraMethods: {
'update' : {
method: 'PUT'
}
@sumitk
sumitk / app.js
Last active August 29, 2015 14:09 — forked from viezel/app.js
// This is an example of use.
// Here we use the new Bearer Token thats make it possible to get tweets without user login
// More info on Bearer here: https://dev.twitter.com/docs/auth/application-only-auth
// Full Codebird API is here: https://github.com/mynetx/codebird-js
var Codebird = require("codebird");
var cb = new Codebird();
cb.setConsumerKey('CONSUMER_KEY', 'CONSUMER_SECRET_KEY');
var bearerToken = Ti.App.Properties.getString('TwitterBearerToken', null);
<?php
/**
* @file
* Default theme implementation to display the basic html structure of a single
* Drupal page.
*
* Variables:
* - $css: An array of CSS files for the current page.
* - $language: (object) The language the site is being displayed in.
# Homework 1 - Part 1
def palindrome?(string)
string = string.downcase.gsub(/\W/, '')
string == string.reverse
end
def count_words(string)
Hash[
string.downcase.scan(/\w+/).
group_by{|s| s}.
@sumitk
sumitk / app.js
Created August 29, 2012 10:35 — forked from pec1985/app.js
FaceBook slide in views
// Create a new project and copy this code into app.js
// if you use this code, please give me credit :)
function JustAView(text){
var view = Ti.UI.createView({
backgroundColor:"#"+((1<<24)*Math.random()|0).toString(16),
width:200,
height:100
});
var label = Ti.UI.createLabel({
@sumitk
sumitk / app.js
Created August 29, 2012 10:32 — forked from dawsontoth/app.js
Pullable Left Menu
var win = Ti.UI.createWindow({
backgroundColor: '#333'
});
var menuWidth = 200;
var container = Ti.UI.createScrollView({
disableBounce: false,
horizontalBounce: true,
contentWidth: Ti.Platform.displayCaps.platformWidth + menuWidth