Skip to content

Instantly share code, notes, and snippets.

@IMDagger
IMDagger / seamless_admin.py
Last active August 29, 2015 13:56
This should be used with care, it's not very deep smoked for all tests and combinations, because is a proof of concept.
# -*- coding: utf-8 -*-
'''
Tricky admin -> xadmin merger.
Alex Moiseenko aka IMDagger.
'''
import logging
import types
from functools import wraps, update_wrapper
from django.http import HttpRequest
from django.contrib.admin import ModelAdmin
@petersanchez
petersanchez / models.py
Last active March 5, 2017 15:09
Simple tracking of Django model data changes
from django.db import models
from django.db.models.signals import post_init
# Generic models...
class Note(models.Model):
note = models.TextField()
class TimeLog(models.Model):
  1. download OpenEmu-Experimental
  2. download BIOS package
  3. unarchive bios package
  4.  duplicate `SCPH5552.BIN` and rename it to `SCPH5501.BIN`
    
  5. open Finder and press CMD + SHIFT + G
  6. fill in with ~/Library/Application Support/OpenEmu and hit Enter
  7. open the BIOS folder, if it's not, create it.
  8. copy SCPH5500.BIN, SCPH5501.BIN, SCPH5502.BIN from the BIOS package folder you downloaded earlier.
  9. open OpenEmu.
  10. select Sony PlayStation from the left pane
+ import LoginRequiredRoute from './LoginRequiredRoute';
<Switch>
<Route path="/login/" component={Login} />
+ <LoginRequiredRoute component={App} />
- <Route component={App} />
</Switch>
@cbracco
cbracco / gist:7ec99d9da5e2a8ac8ed8
Created March 11, 2015 02:43
Convert MP4 to WEBM & OGV using ffmpeg on OSX
ffmpeg -i app/_assets/videos/bg-home-team.mp4 -an -qmax 25 -threads 2 app/_assets/videos/bg-home-team.webm
ffmpeg -i app/_assets/videos/bg-home-team.mp4 -an -c:v libtheora -q:v 7 -threads 2 app/_assets/videos/bg-home-team.ogv
@nirzaq
nirzaq / server.js
Created March 8, 2018 04:11
Cache API Call and Cache rendered pages in Next.js
const express = require("express");
const cors = require("cors")
const { join } = require("path");
const { parse } = require("url");
const next = require("next");
const fetch = require("isomorphic-unfetch")
const LRUCache = require('lru-cache')
const port = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== "production";
@thejmazz
thejmazz / .babelrc
Created February 16, 2016 18:17
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}
@adylevy
adylevy / DeleteButtonWithConfirmation.js
Last active May 22, 2021 11:46
react-admin delete button with confirmation
/*
Copyright (c) 2018 Ady Levy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@molomby
molomby / Keystone 5 - Secure Cookies and Reverse Proxies.md
Created March 31, 2020 05:52
Background and instructions for fixing cookie issues encountered when deploying Keystone 5 apps behind a reverse proxy (like nginx)

Keystone 5: Secure Cookies and Reverse Proxies

Can't sign in, eh?

TL;DR

When...

  • Keystone sessions are being used (eg. for authentication)
  • secureCookies Keystone config is true (the default when NODE_ENV is 'production')
@LatinSuD
LatinSuD / gist:b86280e571ce7fb22b0e2808a0c99ab0
Created September 9, 2021 07:22
Wiki.js search user script
// ==UserScript==
// @name Wiki.js Search
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://mydomain.com/?search=*
// @grant none
// @run-at document-idle
// ==/UserScript==