Skip to content

Instantly share code, notes, and snippets.

View n0m4dz's full-sized avatar

Tseegii Tselmeg n0m4dz

View GitHub Profile
@n0m4dz
n0m4dz / nginx.conf
Created December 17, 2023 21:12 — forked from CSRaghunandan/nginx.conf
Nginx configuration for serving mp4 videos
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@n0m4dz
n0m4dz / findLocalItems.js
Last active February 20, 2023 18:18 — forked from ungoldman/findLocalItems.js
how to filter keys from localStorage with a regex
// returns an array of localStorage items in key/value pairs based on a query parameter
// returns all localStorage items if query isn't specified
// query can be a string or a RegExp object
function findLocalItems (query) {
var i, results = [];
for (i in localStorage) {
if (localStorage.hasOwnProperty(i)) {
if (i.match(query) || (!query && typeof i === 'string')) {
value = JSON.parse(localStorage.getItem(i));
@n0m4dz
n0m4dz / Database.php
Last active September 29, 2022 11:27
PHP PDO database CRUD class
<?php
class Database extends PDO
{
public function __construct($DB_TYPE, $DB_HOST, $DB_NAME, $DB_USER, $DB_PASS)
{
parent::__construct($DB_TYPE.':host='.$DB_HOST.';dbname='.$DB_NAME, $DB_USER, $DB_PASS);
}
@n0m4dz
n0m4dz / leaflet_numbered_markers.css
Created April 14, 2016 01:08 — forked from comp615/leaflet_numbered_markers.css
Numbered Markers in Leaflet (JS Mapping)
.leaflet-div-icon {
background: transparent;
border: none;
}
.leaflet-marker-icon .number{
position: relative;
top: -37px;
font-size: 12px;
width: 25px;
@n0m4dz
n0m4dz / nginx.conf
Created August 24, 2016 11:13 — 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;
@n0m4dz
n0m4dz / python_pretty_time
Last active October 26, 2018 13:49
python pretty time with localization
# coding: utf-8
from datetime import datetime
from datetime import timedelta
def calc_diff(delta):
delta = abs( delta )
return {
'year' : int(delta.days / 365),
'month' : int(delta.days % 365) / 30,
'day' : int(delta.days % 365) % 30,
@n0m4dz
n0m4dz / baseConverter.js
Created March 5, 2018 06:18 — forked from faisalman/baseConverter.js
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@n0m4dz
n0m4dz / sublime-text-osx-context-menu.md
Created February 26, 2018 03:42 — forked from vincentmac/sublime-text-osx-context-menu.md
Sublime Text OSX Context Menu

Add Sublime Text to OS X Context Menu

  • Open Automator
  • Create a new Service
  • Add a Run Shell Script action
  • Set input to Service receives selected files or folders in any application
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n $@
  • Set Pass input to as arguments
  • Save as Open in Sublime Text
@n0m4dz
n0m4dz / LICENCE SUBLIME TEXT
Created February 9, 2018 07:05
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@n0m4dz
n0m4dz / Laravel on VestaCP.md
Created January 29, 2018 10:02 — forked from peterbrinck/Laravel on VestaCP.md
Laravel web templates for VestaCP

I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html