Skip to content

Instantly share code, notes, and snippets.

@huseyinyilmaz
huseyinyilmaz / imagewiththumbnails.py
Created July 22, 2011 07:11
A django thumbnail support example
class ImageWithThumbnail(models.Model):
name = models.CharField(max_length = 255)
image = models.ImageField(upload_to=settings.UPLOAD_ROOT,max_length=500,blank=True,null=True)
thumbnail = models.ImageField(upload_to=settings.UPLOAD_ROOT,max_length=500,blank=True,null=True)
def create_thumbnail(self):
# original code for this method came from
# http://snipt.net/danfreak/generate-thumbnails-in-django-with-pil/
@dwayne
dwayne / 00-install-on-64-bit-ubuntu-14.04.md
Last active January 12, 2024 17:48
Installing node and npm on Ubuntu 12.04 LTS and 64-bit Ubuntu 14.04 LTS.
  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

$ cd ~/Downloads
$ mkdir -p ~/local/node
$ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local/node --strip-components=1
$ echo '# Node Enviroment Setup' >> ~/.bashrc
$ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc
@emre
emre / video_url_to_video_code.py
Created July 5, 2012 22:48
video URL to video code converter for popular video sharing sites.
import re
def videoUrlToVideoCode(url):
if not url.startswith("http://"):
raise ValueError(u'URL http:// ile başlamalıdır.')
pattern_list = [
['youtube.com', 'youtube\.com/watch\?v=([^&]*)'],
['vimeo.com', 'vimeo.com\/([0-9]*)$'],
# The install script
# Adapted from https://gist.github.com/579814
install_path=local
download_path=Downloads/node-latest-install
echo '# Added by install script for node.js and npm in 30s' >> ~/.bashrc
echo 'export PATH=$HOME/'$install_path'/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/'$install_path'/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
anonymous
anonymous / soldier.py
Created August 25, 2015 10:40
class Soldier(object):
TYPE_MAP = {
'kurdish': 'PKK Member',
'alawite': 'DHPKC Member',
'socialist': 'Traitor',
'critic': 'Parallel'
}
@classmethod
def get_type(cls, param):
@mksglu
mksglu / sozcu.disable-popup.js
Created May 31, 2020 10:49
Sözcü'de bazen okumak istediğim bir haber olduğunda ısrarla karşıma çıkan popup'un ağzını yüzünü kıran bir kod parçası.
var p=Array.prototype.slice.call(document.querySelectorAll(".fc-ab-root"));p.forEach(function(o){o.parentNode.removeChild(o)}),document.body.style.overflow="auto";