Skip to content

Instantly share code, notes, and snippets.

View ascott's full-sized avatar
✌️
👌 🌊 ☕️

Alanna Scott ascott

✌️
👌 🌊 ☕️
View GitHub Profile
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active November 19, 2024 00:06
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Want more content like this, for free? Check out my free book, RailsAI!

Alt Text

@gu-ma
gu-ma / colab activity hack
Last active June 24, 2021 10:43
Keep colab active (paste in the console)
// Start
let keepActive = setInterval(()=>{
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click();
setTimeout(()=> {
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click();
}, 5000);
}, 60000)
// Stop
clearInterval(keepActive)
@HanClinto
HanClinto / highresslowmo.ipynb
Created August 6, 2020 18:49
HighResSlowMo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@developit
developit / unistore.js
Last active September 8, 2020 15:13
Update: the newer & better version of this is published: https://github.com/developit/unistore
import { h, Component } from 'preact';
/** Creates a new store, which is a tiny evented state container.
* @example
* let store = createStore();
* store.subscribe( state => console.log(state) );
* store.setState({ a: 'b' }); // logs { a: 'b' }
* store.setState({ c: 'd' }); // logs { c: 'd' }
*/
@orta
orta / fish_lazy_commits.sh
Created March 21, 2016 09:14
Fish versions of my bash commands from Lazy Automation
# http://artsy.github.io/blog/2016/03/02/Lazily-Automation/
function git_branch_info
git branch ^/dev/null | grep \* | sed 's/* //'
end
function branch
git checkout master;
git pull upstream master;
git checkout -b $argv[1]
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active October 1, 2024 17:10
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@caridy
caridy / export-syntax.js
Last active January 15, 2022 14:22
ES6 Module Syntax Table
// default exports
export default 42;
export default {};
export default [];
export default foo;
export default function () {}
export default class {}
export default function foo () {}
export default class foo {}
@bsweger
bsweger / useful_pandas_snippets.md
Last active November 13, 2024 19:55
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@cobyism
cobyism / gh-gmail-label-script.js
Created May 5, 2014 22:25
GitHub Email Notification labeller script for Google Apps/Gmail
var my_teams = ["@github/css", "@github/design"] // Add any teams you want autodetected to this list
var base_label = ["GitHub"]
var my_teams_regex = new RegExp('(' + my_teams.join('|') + ')')
function GitHubThread(thread) {
this._thread = thread
// Determine why we got this message and label the thread accordingly.
//