This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Sorting Color Nodes by Hue</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<style> | |
body { | |
overflow: hidden; | |
background: #333333; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>3D links rolling on hover</title> | |
<style> | |
body { | |
font-family: sans-serif; | |
font-size: 40px; | |
font-weight: bold; | |
text-align: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function Revive (evnt) { | |
onEvent = "on" + evnt; | |
if(window.addEventListener) { | |
window.addEventListener(onEvent, function (e) { | |
for (var node = e.originalTarget; node; node = node.parentNode) { | |
[node] = null; | |
} | |
}, true); | |
window[onEvent] = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DjangoMethodOverrideMiddleware(object): | |
METHODS = ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'CONNECT'] | |
def process_request(self, request): | |
method = request.REQUEST.get("_method", None) | |
if method is None: | |
return | |
else: | |
method = method.upper() | |
if method in self.METHODS: | |
request.method = method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from jsonfield import JSONField | |
from dirtyfields import DirtyFieldsMixin | |
import time | |
class RecordStatusHistoryMixin(DirtyFieldsMixin): | |
def save(self, *args, **kwargs): | |
if not self.pk: | |
# first create | |
current_time = int(time.time()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# project/forum/views.py | |
import json | |
from datetime import datetime | |
from django.http import HttpResponse | |
from django.shortcuts import get_object_or_404 | |
from django.forms.models import model_to_dict | |
from forum.models import Post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Moved to https://github.com/dannvix/yyets-subdl | |
import webbrowser | |
webbrowser.open('https://github.com/dannvix/yyets-subdl') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# dependencies: find, grep, sort, uniq, awk | |
echo 'List all files...' | |
find $1 | |
# output: | |
# a | |
# a/b | |
# a/b/c | |
# a/b/c/d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
# dmhy-magdl.py -- command-downloader for share.dmhy.org | |
import sys | |
import urllib | |
import urllib2 | |
from datetime import datetime, timedelta | |
import webbrowser | |
import xml.etree.ElementTree as ElementTree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iterator> | |
#include <vector> | |
#include <set> | |
// overload for all STL containers | |
template < | |
typename T, | |
typename = typename std::enable_if < | |
std::is_convertible< |