Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dejurin's full-sized avatar
💭
;-)

YURII D. dejurin

💭
;-)
  • Si-ɑR
  • București, România 🇷🇴
  • 16:33 (UTC +03:00)
View GitHub Profile
@denji
denji / http-benchmark.md
Last active April 23, 2024 02:05
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@plentz
plentz / nginx.conf
Last active April 22, 2024 10:54
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@davidtheclark
davidtheclark / isElementInViewport.js
Created May 4, 2013 02:00
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
@jonlabelle
jonlabelle / string-utils.js
Last active October 30, 2023 20:33
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();
@jeffreybarke
jeffreybarke / ci-encryption-key-generator.php
Created April 9, 2013 17:21
This is the code I use (minus Google Analytics) for the CodeIgniter encryption key generator located at http://jeffreybarke.net/tools/codeigniter-encryption-key-generator/
<?php
/**
* Generate an encryption key for CodeIgniter.
* http://codeigniter.com/user_guide/libraries/encryption.html
*/
// http://www.itnewb.com/v/Generating-Session-IDs-and-Random-Passwords-with-PHP
function generate_token ($len = 32)
{
@supairish
supairish / gist:2951524
Created June 18, 2012 23:58
Nginx - how to limit requests by User Agent
http {
map $http_user_agent $limit_bots {
default '';
~*(google|bing|yandex|msnbot) $binary_remote_addr;
}
limit_req_zone $limit_bots zone=bots:10m rate=1r/m;
server {
@loganlinn
loganlinn / do.sh
Created March 22, 2012 23:00
PHP strcmp+strtolower VS strcasecmp Benchmark
for i in 50 100 250 500; do echo "String length: $i"; php strcmpbench.php $i; php strcasecmpbench.php $i; echo "\n"; done
# Example run:
#
# String length: 50
# ************************
# * strcomp + strtolower *
# ************************
# Time: 0.000082
# Memory: 1456
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@behringer24
behringer24 / nginx.conf
Created January 25, 2012 11:23
nginx configuration snippet for dynamic image manipulation using HttpImageFilterModule
/*
* nginx configuration snippet for dynamic image manipulation using HttpImageFilterModule
*
* URL example: http://www.yourserver.com/imgresize/250-100-0/demo.jpg
* Parameters are width-height-rotation
* You need to compile nginx with --with-http_image_filter_module
* More information at http://wiki.nginx.org/HttpImageFilterModule
*/
location ~/imgresize/(?P<width>[0-9]+)-(?P<height>[0-9]+)-(?P<rotate>[0-9]+)/(?P<filename>.+)$ {
rewrite /imgresize/[0-9]+-[0-9]+-[0-9]+/(.+)$ /images/$1 break;