Skip to content

Instantly share code, notes, and snippets.

<?php
$countries = array(
array('name' => 'Afghanistan'),
array('name' => 'Albania'),
array('name' => 'Algeria'),
array('name' => 'American Samoa'),
array('name' => 'Andorra'),
array('name' => 'Angola'),
array('name' => 'Anguilla'),
@ngfw
ngfw / Centos-7-webserver-installation.sh
Last active July 31, 2016 15:54
Installes rsync, vim, nginx, php-fpm mredis, git and php
#!/bin/bash
#
# Cantos 7 quick webserver installation
# Installes rsync, vim, nginx, php-fpm mredis, git and php
# Default Webserver Directory: /home/webserver
# NOTE: script disables SeLinux
#
######## CONFIG ##########
router="index.php"
@ngfw
ngfw / gist:4405c1892d2b96f09a3ebc43285045da
Last active July 28, 2016 21:22
How to be annoying in Terminal
trap '' 2;WW=$(tput cols);HH=$(tput lines); for h in $(seq 1 $HH); do sleep 0.1; for w in $(seq 1 $WW); do printf "\xf0\x9f\x92\xa9 "; sleep 0.1; done; printf "\xF0\x9F\x98\x81 "; done;trap 2;
#!/bin/bash
#
# Server Status Script
# Version 1
CPUTIME=$(ps -eo pcpu | awk 'NR>1' | awk '{tot=tot+$1} END {print tot}')
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
UP=$(echo `uptime` | awk '{ print $3 " " $4 }')
echo "
System Status
@ngfw
ngfw / gist:73e23fa1a9a1ac7c2ff5
Created November 19, 2015 00:48
Remove Non-Georgian Characters from String
<?php
$string = "სატესტო string";
//echo preg_replace('/[^\p{Georgian}]\d/u', '', $string); // Leaves the Numbers
echo preg_replace('/[^\p{Georgian}]/u', '', $string);
// output:
// სატესტო
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
/**
* ngfw
* ---
* copyright (c) 2015, Nick Gejadze
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
var isInIFrame = (window.location != window.parent.location) ? true : false;
if(isInIFrame){
window.parent.location.href = window.location.href;
}
@ngfw
ngfw / gist:7468236
Created November 14, 2013 14:58
add social buttons to profile page
<div class="col-sm-12">
<?php
$this->canonical = \NG\Uri::baseUrl() . \NG\Registry::get('requestedLanguage') . "/people/" . $this->person['id'] ."/". urlencode($this->person['name']);
?>
<div class="well well-sm movieSocialButtons">
<ul class="pull-left">
<li><a href="#" data-url="<?php echo $this->canonical; ?>" class="gplusShare"><span class="micon-google-plus"></span> +1</a></li>
<li class="text-muted"> / </li>
<?php if (isset($this->person['profile_path']) and !empty($this->person['profile_path'])): ?>
<li><a href="#" data-url="<?php echo $this->canonical; ?>" data-media="<?php echo $this->profileOriginalImage . $this->person['profile_path']; ?>" data-description="<?php if(isset($this->person['name'])): echo $this->person['name']; endif;?>" class="pinitShare"> <span class="micon-pinterest"></span> Pinit</a></li>
server {
server_name *.EXAMPLE.COM;
rewrite ^(.*) http://EXAMPLE.COM$1 permanent;
}
server {
listen 80;
server_name EXAMPLE.COM;
root /home/webserver/EXAMPLE.COM/Public;