Skip to content

Instantly share code, notes, and snippets.

View samheutmaker's full-sized avatar
👻

Sam Hogan samheutmaker

👻
View GitHub Profile
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@crtr0
crtr0 / client.js
Created June 8, 2012 17:02
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@Dr-Nikson
Dr-Nikson / README.md
Last active August 12, 2024 10:45
Auth example (react + redux + react-router)
@cdelgadob
cdelgadob / cleanTypenameFieldLink.ts
Last active August 9, 2022 18:20
This is a custom ApolloLink which we use to clean the "__typename" field to prevent sending it to the GraphQL server. omitDeep based on this gist: https://gist.github.com/Billy-/d94b65998501736bfe6521eadc1ab538
@qutek
qutek / calculateStripeFee.js
Created February 3, 2018 06:20
[Calculate Stripe Fee] Calculate stripe fee to ask customer to cover stripe fee #javascript #stripe
/**
* Calculate stripe fee from amount
* so you can charge stripe fee to customers
* lafif <[email protected]>
*/
var fees = {
USD: { Percent: 2.9, Fixed: 0.30 },
GBP: { Percent: 2.4, Fixed: 0.20 },
EUR: { Percent: 2.4, Fixed: 0.24 },
CAD: { Percent: 2.9, Fixed: 0.30 },
@spro
spro / next-ssr-recoil.js
Last active January 7, 2024 16:22
Attempt at SSR with Recoil - setting initial atom values with Next.js getServerSideProps
import {useEffect} from 'react'
import {RecoilRoot, useRecoilState, atom} from 'recoil'
// User data
const user1 = {username: 'joe', bio: "You will never see me, unless of course this example is totally broken."}
const user2 = {username: 'bob', bio: "I am the one true user."}
const user3 = {username: 'fred', bio: "Just kidding, make way for the new guy."}
// Recoil atom to store user. The default user is user1, but it will be
@h4rkl
h4rkl / harkl.js
Last active July 11, 2022 08:19
Can't get the correct signing authority for solana serum anchor implementation
const anchor = require("@project-serum/anchor");
const serumCmn = require("@project-serum/common");
const { TOKEN_PROGRAM_ID } = require("@solana/spl-token");
describe("harkl-tests", () => {
// Configure the client to use the local cluster.
anchor.setProvider(anchor.Provider.env());
const program = anchor.workspace.Harkl;
@Lucifer1590
Lucifer1590 / monitor.py
Created March 12, 2024 15:14
kuzco monitor
import requests
from datetime import datetime
import time
import sys
url = "https://relay.kuzco.xyz/api/trpc/worker.list,metrics.worker?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%221%22%3A%7B%22json%22%3A%7B%22workerId%22%3A%22r-s-RXhWHZ%22%7D%7D%7D"
headers = {
'Authorization': 'Bearer eyJhbGciNzcwMDg4MzNAZ21haWwuY29tIXdL35_GmH7NwLVDuGEdFUWs',
'Content-Type': 'application/json'
}