Skip to content

Instantly share code, notes, and snippets.

var isInIFrame = (window.location != window.parent.location) ? true : false;
if(isInIFrame){
window.parent.location.href = window.location.href;
}
#!/usr/bin/php
<?php
$usage = "Automated Wordpress installer\nby Ali Gangji\nUsage: wordpress install_dir -u dbuser -p dbpass -d dbname\nOptions:\n";
$usage .= " -u dbuser Database username\n";
$usage .= " -p dbpass Database password\n";
$usage .= " -d dbname Database name\n";
$usage .= " -h dbhost Database host\n";
$usage .= " --private Hide blog from search engines\n";
$usage .= " --prefix prefix Database prefix\n";
if ($argc < 2) {
<?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
<!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">
@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:
// სატესტო
@ngfw
ngfw / cleaner.sh
Last active December 26, 2015 20:29
Clear cache files with cron
#!/bin/bash
# Params
# Remove Files Every N Min
MINUTESTOKEEPFILES=2880
# DO NOT EDIT BELOW THIS LINE
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
server {
server_name *.EXAMPLE.COM;
rewrite ^(.*) http://EXAMPLE.COM$1 permanent;
}
server {
listen 80;
server_name EXAMPLE.COM;
root /home/webserver/EXAMPLE.COM/Public;
@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>
#!/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: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;