This file contains hidden or 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 "WebColor" | |
| def equibright hex_s, hex_d | |
| color_s = WebColor.new hex_s | |
| color_d = WebColor.new hex_d | |
| h = color_d.hue | |
| s = color_d.saturation | |
| p = color_s.perceived_brightness | |
| puts WebColor.fromHSP(h,s,p).hex | |
| end |
This file contains hidden or 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
| class WebColor | |
| attr_accessor :r, :g, :b | |
| @@pr, @@pg, @@pb = 0.299, 0.587, 0.114 | |
| @@err = 0.0000001 | |
| def initialize r = 0.0, g = 0.0, b = 0.0 | |
| if r.is_a? Numeric | |
| @r, @g, @b = r, g, b | |
| else |
This file contains hidden or 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
| Optimised, can detect a non collision in one compare, minimally | |
| collision.html | |
| -------------- | |
| <head> | |
| <title>intersect</title> | |
| </head> | |
| <body> |
This file contains hidden or 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
| soundexAlphabet = | |
| 'A': 7, 'B': 1, 'C': 2, 'D': 3, 'E': 7, 'F': 1, 'G': 2, 'H': 8, 'I': 7, 'J': 2, | |
| 'K': 2, 'L': 4, 'M': 5, 'N': 5, 'O': 7, 'P': 1, 'Q': 2, 'R': 6, 'S': 2, 'T': 3, | |
| 'U': 7, 'V': 1, 'W': 8, 'X': 2, 'Y': 7, 'Z': 2, "'": 9, ' ': 9 | |
| soundexCode = (name) -> | |
| soundex = [] | |
| name = name.trim() | |
| if name.length != 0 | |
| index = name.indexOf ' ' |
This file contains hidden or 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
| Meteor.Lookups.insert name: 'location_United States_states', values: 'Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|District of Columbia|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming' | |
| Meteor.Lookups.insert name: 'location_United States_Alabama_cities', values: 'Abernant|Alabaster|Albertville|Alexander City|Andalusia|Anniston|Arab|Athens|Atmore|Attalla|Auburn|Bay Minette|Beauregard-Marvyn|Bessemer|Beulah|Big Sandy-Duncanville|Birmingham|Boaz|Bremen|Center Point|Clanton|Cloverdale|Concord-Hopkins|Craig-Tyler|Cullman|Danville|Daphne|Decatur|Demopolis|Dothan|Enterprise|Eufaula|Fairfield|Fairhope|Florence|Foley|Forestdale|Fort Payne|Fort |
This file contains hidden or 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
| // usage: prime with a set of color stops, then ask for colors in the range. | |
| // | |
| // colors = ['#37d78a','#40be8f','#49a594','#538d9a','#5c749f','#655ba4']; | |
| // colorInterpolator = new ColorInterpolator(); | |
| // colorInterpolator.prime([ | |
| // { value: 0.0, color: colors[0] }, | |
| // { value: 0.2, color: colors[1] }, | |
| // { value: 0.4, color: colors[2] }, | |
| // { value: 0.6, color: colors[3] }, | |
| // { value: 0.8, color: colors[4] }, |
This file contains hidden or 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
| Chicken Tikka Masala | |
| A | |
| 6 garlic cloves grated garlic | |
| 3 tsp grated ginger | |
| 3 tsp turmeric | |
| 2 tsp garam masala | |
| 2 tsp coriander | |
| 2 tsp cumin |
This file contains hidden or 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
| class @Color | |
| constructor: (red, green, blue) -> | |
| if typeof red == 'string' or red instanceof String | |
| color = red | |
| @r = parseInt(color.substring(1,3),16) | |
| @g = parseInt(color.substring(3,5),16) | |
| @b = parseInt(color.substring(5,7),16) | |
| else if red instanceof Color | |
| color = red | |
| @r = color.r |
This file contains hidden or 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
| Root = exports ? @ | |
| App = (Root.App = []) |
This file contains hidden or 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
| # using javascript Date | |
| if Meteor.isClient | |
| updateCurrentTimestamps = -> | |
| current = new Date() | |
| year = current.getFullYear() | |
| month = current.getMonth()+1 | |
| day = current.getDate() | |
| hour = current.getHours() |