Skip to content

Instantly share code, notes, and snippets.

class Solution(object):
def partitionDisjoint(self, A):
"""
:type A: List[int]
:rtype: int
"""
if not A:
return 0
left = A[:1]
right = A[1:]
@ematta
ematta / fix-libv8-mac.txt
Created December 23, 2019 02:00 — forked from fernandoaleman/fix-libv8-mac.txt
Fixing libv8 and therubyracer on Mac
brew install [email protected]
bundle config build.libv8 --with-system-v8
bundle config build.therubyracer --with-v8-dir=$(brew --prefix [email protected])
bundle install
@ematta
ematta / GIF-Screencast-OSX.md
Created February 15, 2018 18:32 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@ematta
ematta / gist:bc0d1e68e0144efeb777
Last active December 19, 2019 12:34
Turbolinks and Selenium Webdriver (Ruby)
driver.execute_script "$(document).on('page:load', function () { window.turbolink = true; });"
driver.execute_script "$(document).on('page:before-change', function () { window.turbolink = false; });"
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { driver.execute_script 'return window.turbolink;' }
Sequel.migration do
up do
# Table: Burndown Project
# String: Name - The name of the project
# String: Description - Short description of the project
create_table(:burndown_project) do
primary_key :id
String :name
String :description
end
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@ematta
ematta / watir-aspnet-postback-workaround.rb
Last active January 4, 2016 18:19
ASP.NET Postback issue work around
browser = Watir::Browser.new :ie
browser.goto http://yourlegacyaspdotnetpage
browser.text_field(:id => 'this_field will_force_a_post_back').set ('This is gonna suck')
browser.send_keys :tab
Watir::Wait.until { browser.ready_state.eql? "complete" }
# Rest of your code
@ematta
ematta / ags-install
Last active January 1, 2016 22:39
How to install AGS on Fedora
# Install AGS in Fedora 20
# https://github.com/adventuregamestudio/ags/blob/master/debian/README.md
# Change this to whatever you use for home dir apps
cd ~/app
git clone git://github.com/adventuregamestudio/ags.git
cd ags
sudo yum -y install python-devel freetype-devel libvorbis-devel allegro-devel allegro libtheora libtheora-devel dumb-devel dumb
make --directory=Engine
sudo make --directory=Engine install