This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <p id="text"></p> | |
| <script> |
| class Player | |
| def initialize(cakes) | |
| end | |
| # Decide who move first - player or opponent (return true if player) | |
| def firstmove(cakes) | |
| # games with < 2 cakes are unwinnable when going first because the starting player | |
| # can always be forced into a loss condition: | |
| # 1 cakes | |
| # - pick 1 (lose, they ate the cake!) |
| var main = function() { | |
| $('.dropdown-toggle').click(function() { | |
| $('.dropdown-menu').toggle(); | |
| }); | |
| $('.arrow-next').click(function() { | |
| var currentSlide = $('.active-slide'); | |
| var nextSlide = currentSlide.next(); |
| var main = function() { | |
| $('.btn').click(function() { | |
| var post = $('.status-box').val(); | |
| $('<li>').text(post).prependTo('.posts'); | |
| $('.status-box').val(''); | |
| $('.counter').text('140'); | |
| $('.btn').addClass('disabled'); | |
| }); | |
| $('.status-box').keyup(function() { |
| # TWITTER API | |
| require 'rubygems' | |
| require 'oauth' | |
| require 'open-uri' | |
| # Parse a response from the API and return a user object. | |
| def parse_user_response(response) | |
| user = nil |
| def top_3_words(text) | |
| words = text.split(/('\w+)|(\w+'\w+)|(\w+')|(\w+)/) | |
| words.max_by(3) {|x| words.length } | |
| end | |
| def top_3_words(text) | |
| words = text.split(/[^a-zA-Z0-9']+/) | |
| words.each{|word| word.downcase!} | |
| puts words |
| if(cache_key in cache) { | |
| console.log('had cache for '+cache_key); | |
| var images = cache[cache_key].images; | |
| cache[cache_key].hits++; | |
| cb(images[getRandomInt(0, images.length-1)]); | |
| } else { | |
| var monthStr = month<10?"0"+month:month; | |
| //lame logic for end of month | |
| var eom = month==2?28:30; | |
| var beginDateStr = year + "-" + monthStr + "-01"; |
| class Plugboard | |
| def initialize(wires = "") | |
| chars = wires.split('') | |
| if chars.length % 2 == 1 || chars.length > 20 | |
| raise | |
| end | |
| @hash = Hash.new | |
| chars.each_with_index do |c, index| | |
| if index % 2 == 0 |
| (1) | |
| def diagsum(matrix) | |
| (0...matrix.length).map{ |i| matrix[i][i] }.reduce(:+) | |
| end | |
| # uses map enumerator for the array of matrix values - remember to use the three-dot notation as it omits the last value since array starts at 0 | |
| # matrix[i][i] indicates the array position of each diagonal value for each row (row, column will be the same value for a square matrix | |
| # reduce(:+) is an enumerator method sums up the block values that were just mapped from the array | |