Skip to content

Instantly share code, notes, and snippets.

@pierreant-p
pierreant-p / README.md
Created December 21, 2017 15:16 — forked from marchelbling/README.md
git hooks

Git hooks for better pivotal integration:

  • pre-commit:
    • prevents commiting on a branch that is not suffixed by an issue number. Some special branches (develop, master) and hotfixes are not constrained
    • lints modified python files and exits upon non correctly formatted modules
    • other formats (js, scss) have pending code that is not currently called as the workflow for front code is not clear
  • prepare-commit-msg: prepend issue number to commit message if it's missing and if it is set in the branch name (see pre-commit hook)
  • post-checkout: [optional] automatically update submodules when checkouting a branch (requires to define the AUTO_SUBMODULE_UPDATE environment variable)

For easy setup:

@pierreant-p
pierreant-p / sketchfab-oembed-patterns.py
Last active December 6, 2016 07:15
sketchfab oembed patterns
import re
# urls for matching models
regex = re.compile(r'^http(s?)://sketchfab.com/(show|models)/(?P<urlid>\w+)')
# Examples
https://sketchfab.com/models/62d77e6a14284e91b2f737d6909e965d
https://sketchfab.com/models/b7LzIm8JrnPw4GBDOMBNGYc39qM
https://sketchfab.com/models/4f4802d5c24847fda35408eed5f9a066
Verifying that +pap is my openname (Bitcoin username). https://onename.io/pap
@pierreant-p
pierreant-p / sketchfab-v2-upload-requests.py
Last active May 6, 2020 18:52
Sketchfab - v2 api upload with requests library
##
# Sample script for uploading to sketchfab
# using the v2 api and the requests library
##
from time import sleep
# import the requests library
# http://docs.python-requests.org/en/latest
# pip install requests
import requests
@pierreant-p
pierreant-p / sketchfab-iframe.js
Created April 8, 2014 10:37
iframe API for the Sketchfab viewer (pending deprecation)
( function ( root, factory ) {
root[ 'sketchfab-iframe' ] = factory( );
} ( this, function ( ) {
/**
* almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
//Going sloppy to avoid 'use strict' string cost, but strict practices should
# easy_install poster
import datetime
import threading
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
import json
import base64
register_openers()
# crafted with love by https://github.com/cambonf
from __future__ import print_function
from urllib.request import urlopen, Request
import mimetypes
import random
import string
# Encode form-data without external dependencies
@pierreant-p
pierreant-p / sketchfab-cocao.m
Created November 26, 2013 23:22
Upload to Sketchfab with Cocoa
//
// AppDelegate.m
// Upload to Sketchfab sample code
//
// Created by Pierre-Antoine Passet on 11/26/13.
// Copyright (c) 2013 Sketchfab. All rights reserved.
//
#import "AppDelegate.h"
#import "AFHTTPRequestOperation.h"
@pierreant-p
pierreant-p / gist:7417126
Last active December 28, 2015 00:59
Serializers inheritance test
import random
from django.db import models
from rest_framework import serializers
class Toto(models.Model):
description = models.CharField()
is_lol = models.BooleanField()
@pierreant-p
pierreant-p / gist:5806781
Last active December 18, 2015 15:49
Sample code for uploading to Sketchfab in C#
/**
* Ensure that you have MultipartForm imported in your project
*/
string url = @ "https://api.sketchfab.com/v1/models";
MultipartForm form = new MultipartForm (url);
form.SetField ("title", "Uber Glasses");
form.SetField ("description", "Test of the api with a simple model");
form.SetField ("token", "FF00FF");