Skip to content

Instantly share code, notes, and snippets.

View p0rsche's full-sized avatar
🧨
Working from home

Vladimir Gerasimov p0rsche

🧨
Working from home
View GitHub Profile
@EastArctica
EastArctica / mui_license_key.txt
Created July 7, 2023 16:01
MUI X License Key
NOTE: The MUI X License Key more than likely isn't going to work. It will have expired. The lifetime license key should... well... last forever...
MUI X License Key (from https://mui.com):
61628ce74db2c1b62783a6d438593bc5Tz1NVUktRG9jLEU9MTY4MzQ0NzgyMTI4NCxTPXByZW1pdW0sTE09c3Vic2NyaXB0aW9uLEtWPTI=
Order Number: MUI-Doc
Expiry Timestamp: 1683447821284(Sun May 7th 08:32:41)
Scope: Premium
Licensing Model: Subscription
Key Version: 2
@amanjuman
amanjuman / Install V2Ray Client on OpenWRT and Configure Vmess
Last active May 11, 2024 06:28
Install V2Ray Client on OpenWRT and Configure Vmess
### The original Author of this package had enabled CloudFlare JS verification. As a result, this automated script will not work.
### Therefore you have to download each package and install it manually.
## Change Directory
cd /tmp/
## Update opkg
opkg update
## If wget not installed already
@jamesarosen
jamesarosen / helper-functions-in-redux.md
Last active June 8, 2023 16:45
Helper Functions in the Redux Store

I have a function that generates image URLs. This function combines some relatively static global configuration with some dynamic data that changes on every invocation. I say "relatively static" because the configuration is loaded asynchronously during the application boot, but remains fixed after that.

Option One

export default async function imageUrl(imageId, { size = 'normal' }) {
  if (imageId == null) return null
  
  const constantsResponse = await fetch('/api/constants')
 const imagesRoot = constantsResponse.json().imagesRoot
@hovi
hovi / django-admin-get-changelist.py
Created October 30, 2019 12:52
change changelist url in django admin as simple as possible (usable with proxies)
from urllib import urlencode
from django.contrib.admin.views.main import ChangeList
from django.urls import reverse
def change_admin_url(model, **kwargs):
class CustomModelChangeList(ChangeList):
def url_for_result(self, obj):
return model_change_url_only(obj, model._meta, **kwargs)
@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@daimagine
daimagine / download-blob.js
Created April 15, 2019 06:12
Download file from API blob result
// 'download-blob.js', inspired by this gist:
// 'dreamyguy/downloadFile.js' https://gist.github.com/dreamyguy/6b4ab77d2f118adb8a63c4a03fba349d
// I added some handler to make it works in Chrome, Safari, and Firefox on iOS
const downloadBlob = (
result,
defaultFilename = 'content.dat',
mime = 'application/octet-stream'
) => {
if (window && result && result.data) {
@amnox
amnox / injectReducer.js
Created March 25, 2019 10:18
A demo implementation of Reducer Injection is React
import React from 'react';
import PropTypes from 'prop-types';
import hoistNonReactStatics from 'hoist-non-react-statics';
import invariant from 'invariant';
import isEmpty from 'lodash/isEmpty';
import isFunction from 'lodash/isFunction';
import isString from 'lodash/isString';
import checkStore from './checkStore';
import createReducer from '../reducers';
import conformsTo from 'lodash/conformsTo';
@p0rsche
p0rsche / time.js
Created March 24, 2018 03:17
Get time in format "mm:hh am|pm"
const timeLocale = 'en-GB'
const timeZone = 'UTC'
const time = (new Date()).toLocaleString(timeLocale, { timeZone: timeZone, hour: 'numeric', minute: 'numeric', hour12: true })
// 10:10 am
@p0rsche
p0rsche / immutableES6ArrayHelpers.js
Last active March 24, 2018 03:18
Immutable ES2015 array helpers
export const addToArrayImmutable = (arr, value) => [...arr, value]
export const unshiftArrayImmutable = (arr, value) => [value, ...arr]
export const updateArrayImmutable = (arr, i, value) => Object.assign([...arr], {[i]: value})
export const removeFromArrayImmutable = (arr, value) => arr.filter(i => i !== value)
@p0rsche
p0rsche / gist:bf9f43c4716cff3f1e6ad3e587e829aa
Created January 9, 2018 21:57
getTransformToElement polyfill
SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function(toElement) {
return toElement.getScreenCTM().inverse().multiply(this.getScreenCTM());
};