Skip to content

Instantly share code, notes, and snippets.

View Discartyptics's full-sized avatar
🌱
sprout

Erik Northfell Discartyptics

🌱
sprout
View GitHub Profile
const nodeRSA = require('node-rsa');
const fetch = require('node-fetch');
const publicKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbM2br48JS2JJy8Ajy0gy33Gu5RNAFgysUp4Mj9FqzXWg7AwdGaXc0vIAGG3vmyrP906qJpiEV1aW9GhsEGNQ9Mjmngfnu1VAKZjskVToqG1ktiXZJKSlVUfGTYj+r1lKDgd2iKt4azIzoeElk1gnLovn8zEaiCT7prHlzWWb7JgW3qp1e12e5WvSC5xX9P5iKOs6WM3qTSAX3e8qGeA9wtlHdQuDjSjWA0WlYQIFKgpoCBNZeldNxel79QgR7QKG6Oo/H4aImhDW9vXH00mGVy9QX11ngovVYPhCQWzsAo+v+Y2lAJUtFdjr2t9/mJisKxpYvpMeqVo2ZSydwBmb5'
const consumerId = 'change this to your consumer id'
const privateKey = "MIIEpAIBAAKCAQEAmzNm6+PCUtiScvAI8tIMt9xruUTQBYMrFKeDI/Ras11oOwMH\
Rml3NLyABht75sqz/dOqiaYhFdWlvRobBBjUPTI5p4H57tVQCmY7JFU6KhtZLYl2\
SSkpVVHxk2I/q9ZSg4HdoireGsyM6HhJZNYJy6L5/MxGogk+6ax5c1lm+yYFt6qd\
XtdnuVr0gucV/T+YijrOljN6k0gF93vKhngPcLZR3ULg40o1gNFpWECBSoKaAgTW\
XpXTcXpe/UIEe0ChujqPx+GiJoQ1vb1x9NJhlcvUF9dZ4KL1WD4QkFs7AKPr/mNp\
@candelatech
candelatech / main.js
Last active September 2, 2021 00:53
Authenticating with the Walmart.io API in Node.js
make_wm_request: async function({method,url,http_body,vendor_id,consumer_id,consumer_pk,channel_type} = {}){
return new Promise(async function(resolve,reject){
//if you don't have a PEM-formatted private key (we didn't), generate one real quick
var pk_chunked = chunkSubstr(consumer_pk, 64).join("\n")
pk_chunked = "-----BEGIN PRIVATE KEY-----\n" + pk_chunked + "\n-----END PRIVATE KEY-----\n"
var epoch_timestamp = Date.now()
@brandonjp
brandonjp / findOverflowParents.js
Last active May 10, 2024 17:30
find overflow:hidden ancestors
// when you're trying to use `position:sticky` on an element
// you'll have trouble if any parent/ancestor element has
// overflow set to anything other than "visible" (such as: auto,hidden,overlay,scroll)
// & turns out if a parent is `display:flex` it might need some love
// (to remedy this you can set the `align-self` of your sticky element)
// see here for how the display & align-self properties affect: http://bit.ly/2ZaRu4o
// so, to find those troublesome parents...
// copy & paste this into Chrome Inspector/Dev Tools console
// (and be sure to change the #stickyElement below, if needed)
@josephbk117
josephbk117 / Billboard.shader
Last active November 12, 2023 18:13
Advanced Billboard Shader For Unity [ Both Quads & UI ]
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage this stuff is not my responsibility*/
Shader "BitshiftProgrammer/Billboard"
{
Properties
{
_MainTex ("Texture Image", 2D) = "white" {}
_Scaling("Scaling", Float) = 1.0
@SiddharthaChowdhury
SiddharthaChowdhury / jwt-module.js
Last active February 21, 2024 14:51
Implementation of JWT using private and public keys
const fs = require('fs');
const jwt = require('jsonwebtoken');
// http://travistidwell.com/blog/2013/09/06/an-online-rsa-public-and-private-key-generator/
// use 'utf8' to get string instead of byte array (1024 bit key)
var privateKEY = fs.readFileSync('./private.key', 'utf8'); // to sign JWT
var publicKEY = fs.readFileSync('./public.key', 'utf8'); // to verify JWT
module.exports = {
sign: (payload, $Options) => {
/*
@alexeychikk
alexeychikk / ReactComment.jsx
Last active September 5, 2022 17:35
Simple React HTML comment
/*
Usage (I however think that the code is self explanatory)
<ReactComment text={`
Very long comment with html link
<a href="https://gist.github.com/alexeychikk/bfe72a072a9a962f2da900b6151e4aae">Star me :)</a>
`} />
*/
import React, {Component, PropTypes} from 'react';
@kawanet
kawanet / material-colors.json
Last active April 18, 2024 07:43
Material Design Style Color Palette as JSON
{
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"200": "#ef9a9a",
"300": "#e57373",
"400": "#ef5350",
"500": "#f44336",
"600": "#e53935",
"700": "#d32f2f",
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active May 7, 2024 22:16
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@SergXIIIth
SergXIIIth / buttons_radio.js.coffee
Created December 17, 2012 21:11
Automatic create and set html hidden field base on Bootstrap buttons radio values Javascript/Coffeescript plugin
# Automatic create and set html hidden field
# base on Bootstrap buttons radio values
# Javascript/Coffeescript plugin
#
# Html/Slim
# .btn-group data-toggle='buttons-radio' data-field='offer[type]' data-init-val=@offer.type
# a.btn href='#' data-val='flat' Flat
# a.btn href='#' data-val='house' House
#
# Usage