Skip to content

Instantly share code, notes, and snippets.

View the-cc-dev's full-sized avatar
💭
searching for inspiration.

Cat the-cc-dev

💭
searching for inspiration.
View GitHub Profile
@jaredpalmer
jaredpalmer / oauth-device-flow.md
Last active September 1, 2021 09:35
OAuth 2.0 Device Flow

OAuth Device Flow

This is flow used by apps on Apple TV / Roku. However, it is also useful for CLIs.

Here is my rundown. Please correct me in comments if something is wrong or if there is a better way to do this.


Device pings the server to begin activation process

@jaredpalmer
jaredpalmer / MarkdownPage.tsx
Created February 17, 2021 13:52
Get headers from MDX in Next.js
import {MDXProvider} from '@mdx-js/react';
import {MDXComponents} from 'components/MDX/MDXComponents';
import {Toc} from 'components/Toc/Toc';
import * as React from 'react';
export interface MarkdownProps<Frontmatter> {
meta: Frontmatter;
children?: React.ReactNode;
}
$(document).ready(() => {
$("#add_bookmark").click(() => {
// Mozilla Firefox Bookmark
window.sidebar && window.sidebar.addPanel(location.href, document.title,"");
// IE Favorite
window.external && window.external.AddFavorite(location.href, document.title);
// Opera Hotlist
if( window.opera && window.print ) {
this.title=document.title;
return true;
@cqsd
cqsd / unlike-tweets.js
Last active August 23, 2022 14:40
script to unlike tweets using twitter web (use on https://twitter.com/USERNAME/likes)
document.onscroll = (() => {
let totalUnliked = 0;
return async () => {
const tweets = document.querySelectorAll('[role="article"]');
await tweets.forEach(async e => {
const likeButton = document.querySelector('[data-testid="unlike"]');
if (typeof likeButton !== 'undefined' && likeButton) {
await likeButton.click();
totalUnliked += 1;
console.log(totalUnliked);
@foxy-develop
foxy-develop / class_foxy_loadmore.php
Created November 12, 2019 23:09
class for create ajax load more button in wordpress
<?php
class Loadmore_Button {
public $article_wrapper = 'article-card';
public $post_per_load = 6;
public $button_text = 'Показать еще';
public $button_loading_text = 'Загрузка...';
public $button_data_attr = 'data-aos="fade-up"';
public $orderby = 'date';
public $article_class = '.all-news__item';
public $button_class = 'all-news__btn-more';
@jonschlinkert
jonschlinkert / recorder.js
Created September 4, 2019 07:55
Simple function for "recording" events and persisting them to the file system. Useful for debugging.
'use strict';
const fs = require('fs');
const path = require('path');
module.exports = name => {
const datapath = path.join(__dirname, `${name}.json`);
const history = [];
const record = (input, key) => {
@mabasic
mabasic / bookstore.apib
Created March 5, 2017 15:51
API Blueprint for Bookstore
FORMAT: 1A
# Bookstore
Bookstore is a simple API which allows consumers to view all books and create new ones.
## Group Book
Resources related to books in the API.
@armand1m
armand1m / Dockerfile
Last active March 10, 2024 14:54
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@augbog
augbog / Free O'Reilly Books.md
Last active March 20, 2025 07:40
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@mabasic
mabasic / User.php
Created September 26, 2016 11:58
Lumen app/User.php after implementing JWTSubject interface and methods.
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Tymon\JWTAuth\Contracts\JWTSubject;