Skip to content

Instantly share code, notes, and snippets.

@ifkas
ifkas / HTML5: Starting Template Snippet
Last active November 5, 2020 18:22
HTML5 snippet - Starter template for Sublime Text 3
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<!-- Global Metas -->
@jasonwash
jasonwash / make_csv.sh
Created March 5, 2014 18:45
Shell script to create a CSV file from a MongoDB collection. The CSV file will contain all possible top-level keys. Embedded documents are not handled.
#!/bin/bash
function usage {
printf "Usage:\n$0 <db_name> <collection_name> <output_csv_file>\n"
exit 1
}
db_name=$1
collection=$2
output_file=$3
@tzmartin
tzmartin / embedded-file-viewer.md
Last active June 15, 2024 19:32
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@bjinwright
bjinwright / .env
Last active March 25, 2022 20:20
Django Settings using Environment Variables via envs (https://github.com/bjinwright/envs) project.
DATABASE_ENGINE=django.db.backends.sqlite3
DATABASE_NAME=db.sqlite3
DATABASE_USER=
DATABASE_PASSWORD=
DATABASE_HOST=
DATABASE_PORT=
SECRET_KEY="asdfdfadsflkjsdflkjadsflkasfakl;"
STATIC_URL=/static/
DEBUG=True
@jonperron
jonperron / gist:733c3ead188f72f0a8a6f39e3d89295d
Last active November 30, 2023 17:29
Serve pandas dataframe as csv with Django
from django.http import HttpResponse
import pandas as pd
def foo():
results = pd.Dataframe()
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=filename.csv'
results.to_csv(path_or_buf=response,sep=';',float_format='%.2f',index=False,decimal=",")
@gengue
gengue / serializers.py
Last active February 2, 2023 03:50
Django Rest Framework user endpoint with change password
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import serializers
from .models import User
class UserSerializer(serializers.ModelSerializer):
"""
User accounts serializer
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active June 14, 2024 17:31
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@delgadofarid
delgadofarid / models.py
Created June 16, 2018 17:17
Corrección Manual Django Semana 2 - 5. Modelos de Django
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey(
'auth.User',
on_delete=models.CASCADE, #Cambio incluido
)
title = models.CharField(max_length=200)
text = models.TextField()
@sww314
sww314 / Dockerfile
Created July 24, 2018 19:42
Django + PostGIS Docker File
FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1
RUN apk update \
# psycopg2 dependencies
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql-dev \
# Pillow dependencies
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
@jdnichollsc
jdnichollsc / ABC.md
Last active April 16, 2024 03:40
The Job Interview Guide

The Job Interview Guide 💼

And English is a Work in Progress ⌛