Skip to content

Instantly share code, notes, and snippets.

@karlhorky
karlhorky / grayscale-disable.css
Created August 26, 2012 12:17
Cross-Browser CSS Grayscale
img.grayscale.disabled {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(0%);
}
@jimothyGator
jimothyGator / README.md
Last active April 25, 2024 18:00
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@fxsjy
fxsjy / SimpleAuthServer.py
Created April 26, 2013 06:23
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):
@victorreyesh
victorreyesh / Aircrack Commands
Created September 12, 2013 03:36
Cracking WPA2 / WEP Wifi / Aircrack 10 seconds guide. For Mac OSX
//Install Macports.
//Install aircrack-ng:
sudo port install aircrack-ng
//Install the latest Xcode, with the Command Line Tools.
//Create the following symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
//Figure out which channel you need to sniff:
sudo airport -s
sudo airport en1 sniff [CHANNEL]
@psdtohtml5
psdtohtml5 / snippet.js
Created October 15, 2013 23:58
JavaScript : Add Business days to a date
// https://github.com/lsmith/addBusinessDays/blob/master/addBusinessDays.js
// var d = new Date();
// addBusinessDays(d, numberOfDays);
function addBusinessDays(d,n) {
d = new Date(d.getTime());
var day = d.getDay();
d.setDate(d.getDate() + n + (day === 6 ? 2 : +!day) + (Math.floor((n - 1 + (day % 6 || 1)) / 5) * 2));
return d;
}
@berzniz
berzniz / jshipster_and_and.js
Last active May 22, 2022 23:15
Some small javascript hacks for hipsters
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
@petersanchez
petersanchez / models.py
Last active March 5, 2017 15:09
Simple tracking of Django model data changes
from django.db import models
from django.db.models.signals import post_init
# Generic models...
class Note(models.Model):
note = models.TextField()
class TimeLog(models.Model):
@thoop
thoop / .htaccess
Last active January 27, 2024 14:07
Official prerender.io .htaccess for Apache.
# Change YOUR_TOKEN to your prerender token
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@danharper
danharper / background.js
Last active May 21, 2024 01:49
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@IMDagger
IMDagger / seamless_admin.py
Last active August 29, 2015 13:56
This should be used with care, it's not very deep smoked for all tests and combinations, because is a proof of concept.
# -*- coding: utf-8 -*-
'''
Tricky admin -> xadmin merger.
Alex Moiseenko aka IMDagger.
'''
import logging
import types
from functools import wraps, update_wrapper
from django.http import HttpRequest
from django.contrib.admin import ModelAdmin