Skip to content

Instantly share code, notes, and snippets.

@illuzian
illuzian / reference.rs
Created August 27, 2017 12:06
Rust code with comments describing references for modification of a value
fn main() {
// This function modifies the values passed in
// Takes in a Vec with types i32 as a reference & and mutable
fn addition(in_vec: &mut Vec<i32>) {
// We've already referenced in_vec so no need for &
for x in in_vec {
// We need to dereference using *
*x = *x + 10;
}
from Tkinter import *
from ttk import *
import urllib
import csv
import operator
from collections import OrderedDict
class Lotto(object):
def __init__(self, url='http://dev-spook/callcentre/jason/MondayLotto-05-01-2015-19-02.csv'):
class SomeClass(object):
def __init__(self, param1=False, param2=False):
self.param1 = param1
self.param2 = param2 #set some variables you could pass in at instantiation eg a = SomeClass(param1=5, param2=6)
# Make some empty variables you plan to use later:
self.some_array = []
self.some_dict = {}
#Hypothetical models.py
from django.db import models
class Something(models.Model):
name = models.CharField(max_length=40)
some_number = models.IntegerField(max_length=5)
#Now you would magically create the table(s) with `python manage.py makemigrations; python manage.py migrate`
#Hypothetical other file accessing the model
import json
import urllib
from PIL import Image
import cStringIO
map_data = "https://static.mwomercs.com/data/cw/mapdata.json"
data = json.load(urllib.urlopen(map_data))
@illuzian
illuzian / 0_reuse_code.js
Created July 26, 2014 11:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@illuzian
illuzian / luz.zsh-theme
Last active August 29, 2015 13:55
Python ZSH Theme With Pure Awesome by Luz
# ------------------------------------------------------------------------
# Anthony Hawkes who totally ripped off junkfood by
# Tyler Cipriani who ripped off
# Totally ripped off Dallas theme
# Anthony Hawkes - Totally modified the code/variables and layour to make
# it more human readable and obvious/less of a fluster cuck. Seperation
# of interests and all that.
# Also made it more pythonated as it'as better(my opinion, but true)
# ------------------------------------------------------------------------