Skip to content

Instantly share code, notes, and snippets.

@wwgist
wwgist / project.sublime-project
Created April 16, 2013 12:27
SUBLIME: sublime-project(settings)
{
"folders":
[
{
"path": "/home/wowkalucky/dev/asnportal_project/_asnportal/",
"folder_exclude_patterns": ["venv","run"]
}
]
}
@wwgist
wwgist / jquery_custom_selector.js
Created June 11, 2013 16:45
JQUERY: custom selector example
$.extend($.expr[':'], {
over100pixels: function(a) {
return $(a).height() > 100;
}
});
$('.box:over100pixels').click(function() {
alert('Элемент, который вы потревожили своим кликом, в высоту более 100 пикселов');
});
@wwgist
wwgist / switch.js
Created June 18, 2013 06:36
JS: switch
switch(n)
{
case 1:
execute code block 1
break;
case 2:
execute code block 2
break;
default:
code to be executed if n is different from case 1 and 2
@wwgist
wwgist / jq_deferreds.js
Created June 18, 2013 09:18
JQUERY: ajax.deferred
$.customMethod = function(){
return $.ajax({
url: '/targetUrl/',
// data: {param1: 'value1'},
dataType: 'jsonp',
}).promise();
};
var outer = $.customMethod();
@wwgist
wwgist / .gitattributes
Created June 20, 2013 05:49
GIT: .gitattributes
# file rule
#----------------
* text=auto
*.rb text
*.js text
*.bat text eol=crlf
*.sh text eol=lf
*.png binary
@wwgist
wwgist / file_upload.html
Created July 12, 2013 09:43
HTML5: files upload
<!-- via control upload -->
<input type="file" id="your-files" multiple>
<script>
var control = document.getElementById("your-files");
control.addEventListener("change", function(event) {
// When the control has changed, there are new files
var i = 0,
files = control.files,
@wwgist
wwgist / .bashrc
Created October 6, 2013 07:25
UBUNTU: .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history
export HISTCONTROL=ignoreboth:erasedups
# set history length
@wwgist
wwgist / .django_bash_completion.sh
Created October 7, 2013 07:17
DJANGO: bash_completition
# #########################################################################
# This bash script adds tab-completion feature to django-admin.py and
# manage.py.
#
# Testing it out without installing
# =================================
#
# To test out the completion without "installing" this, just run this file
# directly, like so:
#
@wwgist
wwgist / timeseqs.py
Created January 1, 2014 13:32
PYTHON: time performance
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
reps = 1000
repslist = range(reps)
@wwgist
wwgist / types.py
Created June 11, 2014 14:09
PYTHON: class creations
"""
Class object creation methods
"""
class Meta(type):
pass
# 1) via definition: