This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.alanmacdougall.underscore._; | |
// and then, after View is added to stage... | |
stage.addEventListener(Event.MOUSE_LEAVE, function handleMouseLeave(event:Event):void { | |
stage.removeEventListener(Event.MOUSE_LEAVE, handleMouseLeave); | |
stage.addEventListener(MouseEvent.MOUSE_OVER, function handleMouseReturn(event:MouseEvent):void { | |
stage.removeEventListener(MouseEvent.MOUSE_LEAVE, handleMouseReturn); | |
// wait 500ms to let other handlers sort themselves out, I guess | |
_(function():void { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sprite.addEventListener(Event.ENTER_FRAME, function handleFrame(event:Event):void { | |
sprite.addEventListener(Event.REMOVED_FROM_STAGE, function(event:Event):void { | |
sprite.removeEventListener(Event.ENTER_FRAME, handleFrame); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sets the value targeted by the key to the value. Only handles key formats | |
* that have been seen "in the wild," but adding new ones is a cinch. Known | |
* formats so far: | |
* | |
* event | |
* event.card | |
* event.card.fonts | |
* event.card.sides.0.assets.0.propertyName | |
* event.card.side(paper,front,0).assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :production_deploy do | |
xpaths = { | |
:debug => "//compiler/debug", | |
:debug_define => "//compiler/define[name='CONFIG::debug']" | |
} | |
# read config xml and set to production mode, storing old values | |
xml = Nokogiri::XML File.open("src/Main-config.xml") | |
debug_node = xml.at_xpath xpaths[:debug] | |
debug_define_node = xml.at_xpath xpaths[:debug_define_node] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# target = 13195 | |
target = 600851475143 | |
sub_target = target | |
current_factor = 2 | |
prime_factors = [] | |
while sub_target > current_factor: | |
while sub_target % current_factor > 0: | |
current_factor += 1 | |
prime_factors.append(current_factor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class NewPaperTest < ActiveSupport::TestCase | |
context "setting design_theme along with family" do | |
# see Paperless::Content::Family -- setting design theme should also load | |
# the family from which the theme comes | |
setup do | |
@paper = create_new_paper | |
@paper.design_theme = {:design_theme => "Red", :family => "Flowers"} | |
@paper.save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Name: focus.vim | |
" Author: Alan MacDougall <smoke@alanmacdougall.com> | |
" License: Public Domain | |
" | |
" Focus on a single column of text, showing it in a distraction-free format. | |
" Save this as ~/.vim/scripts/focus.vim (or whatever you please), and invoke | |
" it with :source <filename>. Of course, you could certainly hook that up to a | |
" :command, or a macro, or a Vimscript function... | |
" collapse current splits and divide screen in three |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
// imports | |
import flash.display.*; | |
import flash.events.*; | |
import flash.filesystem.*; | |
import flash.text.TextField; | |
/** | |
* Quick and dirty AIR file stream test. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bash | |
# | |
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var collection = new DataCollection(apiURL); | |
collection.pageSize = 20; | |
collection.filters = { | |
recommended: function(element) { | |
return element.isRecommended; | |
}, | |
favorite: function(element) { |
OlderNewer