Skip to content

Instantly share code, notes, and snippets.

View mathdroid's full-sized avatar
☢️
not good, not terrible

Odi mathdroid

☢️
not good, not terrible
View GitHub Profile
@jamiebuilds
jamiebuilds / tradeoffs-in-value-derived-types-in-typescript.md
Last active December 16, 2022 17:21
Value-derived types in TypeScript are super powerful, but you should be thoughtful in how/when you use them

Tradeoffs in value-derived types in TypeScript

Many of the more "advanced" typescript features can be used for creating "value-derived" types.

At its simplest form:

let vehicle = { name: "Van", wheels: 4 }
@maskit
maskit / gist:2252422
Created March 30, 2012 15:57
WebSocket traffic sniffer
(function () {
WebSocket.prototype._send = WebSocket.prototype.send;
WebSocket.prototype.send = function (data) {
this._send(data);
this.addEventListener('message', function (msg) {
console.log('>> ' + msg.data);
}, false);
this.send = function (data) {
this._send(data);
console.log("<< " + data);
@nickbutcher
nickbutcher / 1 search_bar.xml
Last active March 26, 2022 10:03
Demonstrating morphing a search icon into a search field. To do this we use an AnimatedVectorDrawable (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) made up of two paths. The first is the search icon (as a single line) the second is the horizontal bar. We then animate the 'trimPathStart' property …
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@airhadoken
airhadoken / twittercard.js
Last active February 4, 2022 18:41
Making twitter cards and also getting data back from them later, in NodeJS.
var T = require("twit");
var Q = require("q");
// key and secret for Twitter for iPhone.
// A whitelisted app is needed to access the cards API; you can't just create your own currently.
var TWITTER_CONSUMER_KEY = "IQKbtAYlXLripLGPWd0HUA";
var TWITTER_CONSUMER_SECRET = "GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU";
// These you will have to fill in yourself by authorizing Twitter for iPhone for your account.
// How to get the access tokens through OOB authorization is outside the scope of this snippet.
var TWITTER_ACCESS_TOKEN = "";
@dabit3
dabit3 / creator-dashboard.js
Last active January 20, 2022 23:14
Metaverse Marketplace pages/creator-dashboard.js
/* pages/creator-dashboard.js */
import { ethers } from 'ethers'
import { useEffect, useState } from 'react'
import axios from 'axios'
import Web3Modal from "web3modal"
import {
nftmarketaddress, nftaddress
} from '../config'
@sibelius
sibelius / RedisCache.ts
Last active July 31, 2021 16:20
Basic RedisCache implementation
import Redis, { KeyType, Ok } from 'ioredis';
const redis = new Redis(process.env.REDIS_HOST);
export const set = async (
key: KeyType,
seconds: number,
value: Record<string, unknown>,
): Promise<Ok> =>
// https://redis.io/commands/psetex
@jaydenseric
jaydenseric / zeit-now-g-suite-setup.md
Created March 20, 2017 04:46
Zeit Now G Suite setup

Run each of the following lines, replacing yourdomain.com and codehere with your details:

now dns add yourdomain.com @ TXT google-site-verification=codehere
now dns add yourdomain.com @ MX ASPMX.L.GOOGLE.COM 1
now dns add yourdomain.com @ MX ALT1.ASPMX.L.GOOGLE.COM 5
now dns add yourdomain.com @ MX ALT2.ASPMX.L.GOOGLE.COM 5
now dns add yourdomain.com @ MX ALT3.ASPMX.L.GOOGLE.COM 10
now dns add yourdomain.com @ MX ALT4.ASPMX.L.GOOGLE.COM 10
//------------------------------------------------
// Report on Budget vs Spend (Hybrid)
// Created by: Remko van der Zwaag & PDDS
// remkovanderzwaag.nl & pdds.nl
// More info: http://goo.gl/d0KVTd
// CHANGELOG
// 12-06-2014: Combined two separate scripts into one Hybrid version (for MCC and accounts)
// 12-02-2015: Added column Spend yesterday and empty columns with days
// 18-06-2015: Added logic to only check campaigns with a specific label
// 03-02-2016: Will check for labelled adgroups in ignored campaigns
@ryantbd
ryantbd / react-native-gitignore
Created April 4, 2015 07:54
react-native-gitignore
# Most part of this file is created by https://www.gitignore.io
### Node ###
# Logs
logs
*.log
# Runtime data
pids
*.pid