Skip to content

Instantly share code, notes, and snippets.

View subomi's full-sized avatar
😝
What did you think you'd find here?

Subomi Oluwalana subomi

😝
What did you think you'd find here?
  • Convoy
  • Lagos, Nigeria
View GitHub Profile
@padenot
padenot / stream.js
Created October 29, 2011 16:33
How to serve media on node.js
var http = require('http');
var path = require('path');
var fs = require('fs');
var AUDIOFILE = "./audio.ogg";
function serveWithRanges(request, response, content) {
var range = request.headers.range;
var total = content.length;
var parts = range.replace(/bytes=/, "").split("-");

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@feross
feross / Respect Rollcall.html
Last active March 9, 2022 04:37
A list of bloggers who I like, pasted from my old blog.
<!-- Respect Rollcall -->
<li><a href="http://www.alistapart.com/articles/">A List Apart &#8212; for website builders</a></li>
<li><a href="http://abstrusegoose.com/">Abstruse Goose &#8212; my favorite comic</a></li>
<li><a href="http://al3x.net/">Alex Payne &#8212; technology rambling</a></li>
<li><a href="http://dashes.com/anil/">Anil Dash &#8212; on culture, apple &amp; design</a></li>
<li><a href="http://weblogs.mozillazine.org/asa/">Asa Dotzler &#8212; on mozilla &amp; software</a></li>
<li><a href="http://www.azarask.in/blog/">Aza Raskin &#8211; on design &amp; firefox</a></li>
<li><a href="http://christophzillgens.com/en/">Christoph Zillgens &#8212; interface design</a></li>
<li><a href="http://cssremix.com/">CSS Remix &#8212; gorgeous designs</a></li>
<li><a href="http://css-tricks.com/">CSS Tricks</a></li>
require 'date'
class FirebasePush
PUSH_CHARS = '-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'
def initialize
@prev_ts = 0
@rand_chars = Array.new(12)
end
@mbd-s
mbd-s / Twitter-gem.md
Last active May 1, 2022 08:21
Building a simple Twitter bot with the Twitter Ruby gem

##Twitter gem overview

The Twitter Ruby gem is a Ruby interface to the Twitter API. It allows you to make all available Twitter API requests (e.g., tweet, follow a user, search, etc.) within a Rails app.

This guide was adapted from multiple sources, including the Twitter Ruby gem configuration page and How to Make a Twitter Bot in Ruby on Rails. Twitter's own API docs are a good resource too, of course.


####Get set up with Twitter To begin, you'll need to register your application with Twitter and get the proper keys. Log into or sign up for a Twitter account, and scroll down to "Manage Your Apps." Click "Create a New App" and fill out the form with the app's details. Once you're on the app's management page, select the "Permissions" tab. Make sure access is set to "Read a

function makepayment(key, email, amount, ref, callback) {
var handler = PaystackPop.setup({
key: key, // This is your public key only!
email: email || 'customer@email.com', // Customers email
amount: amount || 5000000.00, // The amount charged, I like big money lol
ref: ref || 6019, // Generate a random reference number and put here",
metadata: { // More custom information about the transaction
custom_fields: [
{}
]
<script src='https://js.paystack.co/v1/inline.js'></script>
# HELP mothership_collector_working Is the master process collector able to collect metrics
# TYPE mothership_collector_working gauge
mothership_collector_working 1
# HELP mothership_collector_rss total memory used by collector process
# TYPE mothership_collector_rss gauge
mothership_collector_rss 243605504
@gaearon
gaearon / modern_js.md
Last active July 18, 2024 10:37
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers