Skip to content

Instantly share code, notes, and snippets.

View telingadigital's full-sized avatar

Telinga Digital telingadigital

View GitHub Profile
@telingadigital
telingadigital / finding_duplicate.sql
Created April 11, 2018 05:59
Finding Duplicate Values in MySQL
SELECT name, COUNT(*) c FROM table GROUP BY name HAVING c > 1;
@telingadigital
telingadigital / php.ini
Created February 12, 2018 12:00
My Kind of PHP.INI Setting for local development
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@telingadigital
telingadigital / nginx.conf
Created February 12, 2018 10:45
My Kind of Nginx Conf setting for Local Development on Windows
#user nobody;
worker_processes 5;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 4096;
}
@telingadigital
telingadigital / palindrome.js
Created February 6, 2018 17:14
Check Whether A String Palindrome Javascript
function isPalindrome(str) {
str = str.match(/[A-Za-z0-9]/gi).join("").toLowerCase();
for(var i = 0; i < Math.floor(str.length/2); i++) {
if(str.charAt(i) !== str.charAt(str.length-i-1)) {
return false;
}
}
return true;
}
@telingadigital
telingadigital / remove_string.js
Created February 6, 2018 17:01
Remove String Only in array Javascript
function removeString(arr){
for(var i = arr.length-1; i--;){
if (typeof arr[i] === 'string')
arr.splice(i, 1);
}
}
@telingadigital
telingadigital / remove_odd.js
Created February 6, 2018 17:00
Remove Odd number from array Javascript
function removeOdd(arr){
for(var i = arr.length-1; i--;){
if (arr[i]%2 !== 0)
arr.splice(i, 1);
}
}
@telingadigital
telingadigital / default.conf
Created February 4, 2018 11:40
Default Server Block Nginx Configuration in Windows
server {
listen 80 default_server;
server_name _;
root c:/nginx/html;
location / {
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
@telingadigital
telingadigital / php.dev.conf
Created February 4, 2018 11:39
Nginx Server Block Configuration for PHP in Windows with SSL
server {
listen 443 ssl http2;
server_name telingadigital.dev www.telingadigital.dev;
root c:/nginx/html/telingadigital/public/;
# SSL Conf
ssl_certificate c:/nginx/ssl/td.dev.pem;
ssl_certificate_key c:/nginx/ssl/td.dev.key;
@telingadigital
telingadigital / node.dev.conf
Created February 4, 2018 11:38
Nginx Server Block Configuration For Running NodeJS on Windows with SSL
server {
listen 443 ssl;
server_name node.dev www.node.dev;
# SSL Conf
ssl_certificate c:/nginx/ssl/node.dev.pem;
ssl_certificate_key c:/nginx/ssl/node.dev.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
@telingadigital
telingadigital / camelToSnake.php
Created January 24, 2018 08:07
Convert CamelCase to Snake-Case
<?php
function convert($string) {
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $string));
}
echo convert('AnyStringAvailable');