Skip to content

Instantly share code, notes, and snippets.

View crynobone's full-sized avatar
🖥️
Working

Mior Muhammad Zaki crynobone

🖥️
Working
View GitHub Profile
@alanhamlett
alanhamlett / ajax_setup.js
Last active January 13, 2021 02:18
Sets the X-CSRFToken header for every jQuery ajax non-GET request to make CSRF protection easy. This fixes the example from Django docs here: https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
@JesseObrien
JesseObrien / name.conf
Last active December 19, 2015 06:18
A Good Nginx Config
server{
listen 80;
# Uncomment for SSL
#listen 443;
server_name example.com www.example.com;
# Uncomment for SSL
#ssl on;
#ssl_certificate /etc/ssl/mycert.crt;
#ssl_certificate_key /etc/ssl/mycert.key;
@machuga
machuga / Gemfile
Last active December 14, 2015 17:29
Guard for Jasmine CLI tests
source :rubygems
gem 'guard'
gem 'guard-shell'
gem 'rb-fsevent', :require => false
gem 'terminal-notifier-guard' # This will use OSX native notifications
@sumardi
sumardi / mpnml
Created November 21, 2012 10:32 — forked from romanr/mpnml
Mysql, Php-fpm, Nginx on OSX Mountain Lion
sudo port -v install mysql5-server
sudo -u _mysql mysql_install_db5
# if above command produce this error: ERROR: 1004 Can't create file '/var/tmp/#sqle967_1_0.frm' (errno: 9)
# do this:
# sudo chown -R mysql:mysql /opt/local/var/db/mysql5
# sudo chmod u+rwx,go= /opt/local/var/db/mysql5
# sudo /opt/local/lib/mysql5/bin/mysql_install_db --user=mysql