Skip to content

Instantly share code, notes, and snippets.

View DeviaVir's full-sized avatar
🏴‍☠️

Chase DeviaVir

🏴‍☠️
View GitHub Profile
@DeviaVir
DeviaVir / include_foundation.js
Created March 1, 2013 11:50
Fix foundation JS
// Original:
document.write('<script src=/js/vendor/'
+ ('__proto__' in {} ? 'zepto' : 'jquery')
+ '.js></script>');
// UNEXPECTED TOKEN ILLEGAL
// Should be:
document.write(unescape('%3Cscript src=/js/vendor/' + ('__proto__' in {} ? 'zepto' : 'jquery') + '.js%3E%3C/script%3E'));
@DeviaVir
DeviaVir / redis-sentinel
Last active February 13, 2019 20:06
An init.d script for redis sentinel, to have it run as a daemon instead of in a screen. (Tested on CentOS 6)
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@DeviaVir
DeviaVir / dabblet.css
Created May 11, 2013 17:18
Circular Tooltip (SO)
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */
@DeviaVir
DeviaVir / ios.reconnect.js
Created May 15, 2013 10:40
iOS devices kill JS execution the second you switch away, this function detects when the JS execution continues and automatically reconnects with socket.io
var browsers = {
isiOS: function() {
return ( navigator.userAgent.indexOf( 'iPad' ) > -1
|| navigator.userAgent.indexOf( 'iPhone' ) > -1
|| navigator.userAgent.indexOf( 'iPod' ) > -1 );
}
};
// Moving away from this tab..
if( browsers.isiOS() ) {
@DeviaVir
DeviaVir / nginx
Created October 16, 2013 09:50
CENTOS /etc/init.d/nginx After placing don't forget to chmod +x chmod +x /etc/init.d/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@DeviaVir
DeviaVir / php-fpm
Created October 16, 2013 10:22
CENTOS /etc/init.d/php-fpm Don't forget to chmod +x /etc/init.d/php-fpm to make it executable
#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon
@DeviaVir
DeviaVir / php-fpm.conf
Created October 16, 2013 10:41
/usr/local/etc/php-fpm.conf
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
@DeviaVir
DeviaVir / nginx.conf
Created October 16, 2013 10:58
/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@DeviaVir
DeviaVir / fastcgi_params
Created October 17, 2013 00:42
/etc/nginx/fastcgi_params
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
@DeviaVir
DeviaVir / redis-server
Created October 17, 2013 12:09
/etc/init.d/redis-server
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid