Skip to content

Instantly share code, notes, and snippets.

@varqasim
varqasim / index.html
Last active August 29, 2015 14:27
How a template would look like when using two models in a Django ListView http://stackoverflow.com/questions/12187751/django-pass-multiple-models-to-one-template
{% for post in posts %}
<a href="{% url 'post' post_name_slug=post.slug %}"></a>
{% endfor %}
{% for post_comments in comments %}
{{ post_comments }}
{% endfor %}
@varqasim
varqasim / models.py
Created August 22, 2015 18:17
Uploading multiple images in Django using Fromset(modelformset_factory). Read more on my blogpost http://qasimalbaqali.com/uploading-multiple-images-in-django-for-a-single-post/
class PostForm(forms.ModelForm):
title = forms.CharField(max_length=128)
body = forms.CharField(max_length=245, label="Item Description.")
class Meta:
model = Post
fields = ('title', 'body', )
class ImageForm(forms.ModelForm):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RandomNameGeneratorLibrary;
namespace VDBCore
{
public class Flight
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDBCore
{
public class Baggage
{
@varqasim
varqasim / .block
Created October 21, 2019 09:48
Fast Interactive Canvas Scatterplot
license: mit
@varqasim
varqasim / .block
Last active December 24, 2019 10:25
Pie Chart
license: mit
@varqasim
varqasim / index.js
Last active November 22, 2020 18:12
Create a Pulumi stack on PR creation
var path = require("path");
var { LocalWorkspace } = require("@pulumi/pulumi/x/automation");
// get node command arguments, if the user
// passed `destroy`.
var args = process.argv.slice(2);
var destroy = false;
if (args.length > 0 && args[0]) {
destroy = args[0] === "destroy";
name: Pulumi Preview
on:
pull_request:
branches: [master, release, staging, development]
jobs:
preview:
name: Preview
runs-on: ubuntu-latest
steps:
- name: Checkout repo
name: PR Merged
on:
pull_request:
types: [closed]
jobs:
destroy:
name: Destroy Pulumi Stack and Resources
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
@varqasim
varqasim / Dockerfile
Created January 23, 2021 23:02
NodeJS "Hello World" Dockerised App
FROM node:12.16.3-alpine
COPY package.json package-lock*.json ./
RUN npm install
COPY . .
RUN npm run build