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
defmodule Equality do | |
@tests [ | |
0, | |
1, | |
-1, | |
2, | |
-2, | |
10, | |
-10, | |
3, |
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
#!/usr/bin/env ruby | |
emoji = ["bowtie", "smile", "laughing", "blush", "smiley", "relaxed", "smirk", "heart_eyes", | |
"kissing_heart", "kissing_closed_eyes", "flushed", "relieved", "satisfied", "grin", | |
"wink", "stuck_out_tongue_winking_eye", "stuck_out_tongue_closed_eyes", "grinning", | |
"kissing", "kissing_smiling_eyes", "stuck_out_tongue", "sleeping", "worried", "frowning", | |
"anguished", "open_mouth", "grimacing", "confused", "hushed", "expressionless", "unamused", | |
"sweat_smile", "sweat", "disappointed_relieved", "weary", "pensive", "disappointed", | |
"confounded", "fearful", "cold_sweat", "persevere", "cry", "sob", "joy", "astonished", | |
"scream", "neckbeard", "tired_face", "angry", "rage", "triumph", "sleepy", "yum", "mask", |
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
table { width: 100%; } |
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
<canvas id='canvas'></canvas> | |
<span id='info'>Click and drag to draw!<span> | |
<!-- | |
Drawing with text: | |
- Click and drag to draw. | |
- Double click to clear. | |
Ported from java at http://www.generative-gestaltung.de |
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 i18n = (function(){ | |
// this copy of the i18n object is for the constructor | |
var i18n = function(){ | |
// privleged vars | |
var _locales = {}; | |
// public vars | |
this.locale = 'en'; | |
// priviledged methods that can access local variables; |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
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
<!-- Solution brought to you by Caroline Schnapp --> | |
<!-- See this: http://wiki.shopify.com/Related_Products --> | |
{% assign number_of_related_products_to_show = 3 %} | |
{% assign image_size = 'compact' %} | |
{% assign heading = 'Other fine products' %} | |
{% capture number_of_related_products_to_fetch %}{{ number_of_related_products_to_show | plus: 1 }}{% endcapture %} | |
{% if collection == null or collection.handle == 'frontpage' or collection.handle == 'all' %} |
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
>> # Before optimizations (easy to find the log entries, thanks to MongoDB logging): | |
>> log.find(:action => 'home', | |
:controller => 'asset', | |
:request_time => {'$lt' => 20.minutes.ago} | |
).each{|r| puts "#{r['request_time']} | #{r['runtime']}ms"} | |
Fri Sep 25 17:04:36 UTC 2009 | 8648 ms | |
Fri Sep 25 17:04:54 UTC 2009 | 5557 ms | |
Fri Sep 25 18:01:49 UTC 2009 | 5813 ms | |
Fri Sep 25 18:07:21 UTC 2009 | 8377 ms |
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
>> db = Mongo::Connection.new.db('golden_child') | |
=> #<Mongo::DB:0x104f2bed0 @name="golden_child", @host="localhost", @pk_factory=nil, @socket=#<TCPSocket:0x104f2b4f8>, @slave_ok=nil, @port=27017, @nodes=[["localhost", 27017]], @auto_reconnect=nil, @semaphore=#<Object:0x104f2bd90 @mu_locked=false, @mu_waiting=[]>, @strict=nil> | |
>> coll = db['development.log'] | |
=> #<Mongo::Collection:0x104f252d8 @name="development.log", @db=#<Mongo::DB:0x104f2bed0 @name="golden_child", @host="localhost", @pk_factory=nil, @socket=#<TCPSocket:0x104f2b4f8>, @slave_ok=nil, @port=27017, @nodes=[["localhost", 27017]], @auto_reconnect=nil, @semaphore=#<Object:0x104f2bd90 @mu_locked=false, @mu_waiting=[]>, @strict=nil>, @hint=nil> | |
>> coll.find(:action => 'show', :controller => 'cart').count | |
=> 5 |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.vitalsource.golden_child.clear_inactive_carts</string> | |
<key>EnvironmentVariables</key> | |
<dict> | |
<key>RAILS_ENV</key> | |
<string><%= rails_env %></string> |
NewerOlder