This file contains hidden or 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
""" | |
module mydjangolib.bigint_patch | |
A fix for the rather well-known ticket #399 in the django project. | |
Create and link to auto-incrementing primary keys of type bigint without | |
having to reload the model instance after saving it to get the ID set in | |
the instance. | |
Logs: |
This file contains hidden or 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
<div class="container"> | |
<div class="row"> | |
<div class="col-sm-6 col-md-4 col-md-offset-4"> | |
<h1 class="text-center login-title">Sign in to continue to Bootsnipp</h1> | |
<div class="account-wall"> | |
<img class="profile-img" src="https://lh5.googleusercontent.com/-b0-k99FZlyE/AAAAAAAAAAI/AAAAAAAAAAA/eu7opA4byxI/photo.jpg?sz=120" | |
alt=""> | |
<form class="form-signin"> | |
<input type="text" class="form-control" placeholder="Email" required autofocus> | |
<input type="password" class="form-control" placeholder="Password" required> |
This file contains hidden or 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
// http://www.geeksforgeeks.org/a-program-to-check-if-a-binary-tree-is-bst-or-not/ | |
bool isBST(struct node* root) | |
{ | |
static struct node *prev = NULL; | |
// traverse the tree in inorder fashion and keep track of prev node | |
if (root) | |
{ | |
if (!isBST(root->left)) | |
return false; |
This file contains hidden or 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
# requires python 3.2.3 or higher | |
import concurrent.futures | |
def f(x): | |
print ("working on task: %s" %{x}) | |
if x-1 > 0 : | |
return x-1 # I want this task back in the queue. | |
def main(): | |
Queue = [x for x in range(4)] |
This file contains hidden or 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
// ==UserScript== | |
// @name railwayTicketFormAutoField | |
// @namespace http://railway.hinet.net/ctno1.htm | |
// @description Change some element on login page | |
// @include http://*railway.hinet.net/ctno1.htm | |
// ==/UserScript== | |
var personalId = 'A123456789'; // 身份正字號 | |
var fromStation = '100'; // 台北 |
This file contains hidden or 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 | |
# | |
# This hook does two things: | |
# | |
# 1. update the "info" files that allow the list of references to be | |
# queries over dumb transports such as http | |
# | |
# 2. if this repository looks like it is a non-bare repository, and | |
# the checked-out branch is pushed to, then update the working copy. | |
# This makes "push" function somewhat similarly to darcs and bzr. |
This file contains hidden or 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 https://djangosnippets.org/snippets/2309/#! | |
from django.db import models | |
from django.contrib.contenttypes.models import ContentType | |
from django.core.urlresolvers import reverse | |
class AutomagicModel(models.Model): | |
class Meta: | |
abstract=True | |
def get_absolute_url(self): |
This file contains hidden or 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
/* http://stackoverflow.com/questions/18424798 */ | |
@media(max-width:767px){} | |
@media(min-width:768px){} | |
@media(min-width:992px){} | |
@media(min-width:1200px){} |
This file contains hidden or 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 <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <math.h> | |
int main (int argc, char *argv[]) | |
{ | |
FILE *urandom; | |
unsigned int seed; |