Skip to content

Instantly share code, notes, and snippets.

@martyzz1
martyzz1 / gist:bad31146fb1a74afa3ffc110f16274dc
Last active July 27, 2021 09:05
Make Chrome app for a given url
const startUrl = window.location.href;
document.head
.querySelector(':first-child')
.insertAdjacentHTML(
'beforebegin',
`<link rel="manifest" href='data:application/manifest+json,{"start_url":"${startUrl}"}' />`,
);
@martyzz1
martyzz1 / gist:e7569a14a3e738c8f1d0982bc46fdfec
Last active October 14, 2018 21:29
Pypi Release process
  • Update HISTORY.rst
  • Update version number in my_project/__init__.py
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion --current-version 3.3.0 minor setup.py
@martyzz1
martyzz1 / gulp-ionic-deploy.js
Created November 25, 2016 17:31 — forked from AgDude/gulp-ionic-deploy.js
Gulp task to upload and deploy to ionic with metadata.
gulp.task('deploy', function () {
runSequence(
'ionic-password',
// 'bump-build',
// ['clean'],
// ['jshint', 'sass', 'config', 'templates'],
// 'bundle',
// 'index',
// 'clean-index',
// 'copy',
@martyzz1
martyzz1 / gist:71c8c487a067e1eec31d
Created December 21, 2015 13:16
How to connect to None US S3 using Boto2, for CNAME'd subdomain buckets - useful if you get S3ResponseError: S3ResponseError: 301 Moved Permanently or CertificateError: hostname 'sub.primarydomain.com.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com
conn = boto.s3.connect_to_region(
'eu-west-1',
aws_access_key_id=<AWS_ACCESS_KEY_ID>,
aws_secret_access_key=<AWS_SECRET_ACCESS_KEY>,
calling_format=ProtocolIndependentOrdinaryCallingFormat()
)
bucket = conn.get_bucket('sub.primarydomain.com')
prefix = 'some/prefix/'
rs = bucket.list(prefix=prefix)
def linkable_content(request):
if not request.user.is_staff:
return HttpResponseForbidden()
linkable = {
'0_Country': {},
'1_Section': {},
'2_Article': {},
'3_StaticPage': {}