Skip to content

Instantly share code, notes, and snippets.

View svict4's full-sized avatar
🏦
shilling crypto

Simon Victory svict4

🏦
shilling crypto
View GitHub Profile
@Froelund
Froelund / _error.tsx
Last active November 30, 2023 04:35
Next.js Typescript error reporting
import { captureException, flush } from '@sentry/nextjs';
import NextErrorComponent from 'next/error';
import type { ErrorProps } from 'next/error';
import type { NextPage } from 'next';
interface AppErrorProps extends ErrorProps {
err?: Error;
hasGetInitialPropsRun?: boolean;
}
@keyboardcrunch
keyboardcrunch / pydocexec.py
Created April 30, 2020 02:24
Injects a python script inside a word document so the doc can be executed with python :)
#!/usr/bin/python3
import sys
import os
import zipfile
import tempfile
from xml.etree import ElementTree
from shutil import copyfile
def stuffer(py_file, doc_file):
const fs = require("fs");
const SentryCli = require("@sentry/cli");
function truncateHash(hash) {
return hash.trim().substring(0, 7)
}
function getShortHash() {
const rev = fs.readFileSync(".git/HEAD").toString();
if (rev.indexOf(':') === -1) {
@ngbrown
ngbrown / AuthProvider.tsx
Last active June 18, 2021 09:24
useAuth React authentication with oidc-client
import React, {
createContext,
useReducer,
useEffect,
useState,
useContext,
} from 'react';
import * as Oidc from 'oidc-client';
// Inspired by https://github.com/Swizec/useAuth
@thisisrachelramos
thisisrachelramos / 00_README
Last active April 6, 2021 08:33 — forked from dogeared/00_README
Extracting / Exporting custom emoji from Slack
This builds off the excellent work of @lmarkus.
The scripts below can be used in conjunction with the Neutral Face Emoji Tools Google Chrome extension to (bulk!)
export emojis from one Slack team and import into another team:
https://chrome.google.com/webstore/detail/neutral-face-emoji-tools/anchoacphlfbdomdlomnbbfhcmcdmjej
Original work here: https://gist.github.com/lmarkus/8722f56baf8c47045621
Steps:
1) Run js in dev tools
@sitefinitySDK
sitefinitySDK / InlineEditingView.cshtml
Created February 24, 2018 22:04
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/feather-enable-inline-editing-in-widgets
//Enable inline editing:
<li @Html.InlineEditingAttributes(Model.ProviderName, "Telerik.Sitefinity.News.Model.NewsItem", item.Id)>
</li>
//Enable editiong of a particular field:
<a @Html.InlineEditingFieldAttributes("Title", "ShortText") href="…">@item.Title</a>
@Chris820
Chris820 / Vagrantfile
Last active December 19, 2023 06:04
My Vagrantfile. Creates a LAMP environment suitable for Drupal and Wordpress development.
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "~/Documents/Sites", "/var/www/html", mount_options: ["dmode=777", "fmode=777"]
config.vm.synced_folder "~/vagrant-localdev/db-details", "/var/www/db-details"
config.vm.synced_folder "~/vagrant-localdev/configs", "/etc/apache2/sites-enabled"
config.vm.synced_folder "~/vagrant-localdev/logs", "/var/www/logs"
config.vm.synced_folder "~/vagrant-localdev/scripts", "/home/vagrant/scripts"
config.vm.synced_folder "~/Documents/Transfer", "/home/vagrant/transfer"
# Plenty of memory and CPU cores
@shohagbhuiyan
shohagbhuiyan / australian-postcodes.csv
Last active September 6, 2019 19:47 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude. SQL, JSON, CSV format.
We can't make this file beautiful and searchable because it's too large.
Postcode, Suburb, State, Lat, Lan
200, Australian National University, ACT, -35.280, 149.120
221, Barton, ACT, -35.200, 149.100
800, Darwin, NT, -12.800, 130.960
801, Darwin, NT, -12.800, 130.960
804, Parap, NT, -12.430, 130.840
810, Alawa, NT, -12.380, 130.880
810, Brinkin, NT, -12.380, 130.880
810, Casuarina, NT, -12.380, 130.880
810, Coconut Grove, NT, -12.380, 130.880
@bySebastian
bySebastian / drupal-twig-tweak
Created November 30, 2017 16:07
[Twig tweak] Cheat sheet #drupal
<dl class="examples">
{# This accepts views arguments as well. #}
<dt>View:</dt>
<dd>{{ drupal_view('who_s_new', 'block_1') }}</dd>
{# The block should be configured on "admin/structure/block" page. #}
<dt>Block:</dt>
<dd>{{ drupal_block('system_powered_by_block') }}</dd>
@milankorsos
milankorsos / redux-actions.ts
Last active November 10, 2022 10:58
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};