Skip to content

Instantly share code, notes, and snippets.

@keijiro
keijiro / 00_blot5.md
Last active October 15, 2021 12:13
KodeLife fragment shader sketch

gif

@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active January 17, 2023 18:52
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
@rhysforyou
rhysforyou / gist:8e396099831aa44086af
Last active August 19, 2017 17:07
Ripping PS1 Games on OS X

Note: This method doesn't work for multitrack game disks that I've tried, such as those that include audio files on separate tracks like Vib Ribbon.

Also don't go using this method to distribute copies of PS1 games on the internet. That's super illegal and uncool.

  1. Insert the game disk, wait for it to mount
  2. Open Disk Utility, right click the game disk, and choose Unmount
  3. Open Terminal and run diskutil list, make note of where the game disk was mounted (something like /dev/disk3)
  4. Run sudo dd if=<disk> of=foo.iso where <disk> is the mount point we got in the last step (you can call the ISO whatever you want)
  5. Download LiquidCD and extract it
  6. Open LiquidCD, go to the Others tab, and then click Choose a disk image… supplying the disk image you made last step, if asked, let it analyse the tracks in that ISO
@danicat
danicat / avltree.h
Last active March 15, 2022 23:38
AVL Tree implementation in C++ using templates. Still missing some functionality though, like deletion. Work in progress.
#ifndef DANI_AVL_TREE_H_
#define DANI_AVL_TREE_H_
/*
Balanced Binary Search Tree using AVL algorithm.
Depends: list.h (see github for newest version).
Author: Daniela Petruzalek (https://gist.github.com/danicat)
Date : October, 20th 2013

Installation

FreeBSD

portmaster irc/irssi
portmaster irc/irssi-xmpp

OS X

brew install irssi

@wlangstroth
wlangstroth / deploy.rb
Last active September 11, 2021 13:15
Capistrano + Nginx + Unicorn + Sinatra on Ubuntu
require 'bundler/capistrano'
set :application, "net"
set :repository, "git@githost.com:net.git"
set :scm, :git
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
@them0nk
them0nk / rspec_rails_cheetsheet.rb
Created March 23, 2012 03:39
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@FGRibreau
FGRibreau / times.js
Created February 5, 2012 22:45
Ruby .times & .upto & .downto methods in JavaScript
// Ruby = 5.times { |i| puts i }
// JS = (1).times(function(i){console.log(i);})
Number.prototype.times = function(cb) {
var i = -1;
while (++i < this) {
cb(i);
}
return +this;
#!/usr/bin/env ruby
require 'csv'
require 'json'
if ARGV.size != 2
puts 'Usage: csv_to_json input_file.csv output_file.json'
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects'
exit(1)
end