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 window.Utils | |
| @flash: (msg,type='') -> | |
| $container = $("body") | |
| $container.prepend JST['flash'](msg: msg) | |
| $alert = $(".alert:first-child",$container) | |
| if type isnt '' | |
| $alert.addClass "alert-#{type}" | |
| $alert.css | |
| "-webkit-transform": "scale(0)" |
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
| content = "Meet Mr. Jon. Jon is a computer programmer and lives in Connecticut. Jon is tall. Shouldn't take web 2.0 as two sentences. And this is a new sentence. " | |
| words = {} | |
| content.gsub!(/(Mr)\.|(Mrs)\./,"\\1{dot}").split(/\. |\? |\! /).each_with_index do |sentences, index| | |
| puts "\n#{index}: #{sentences}" | |
| sentences.split(/ +/).each do |word| | |
| word=word.gsub(/{dot}/,"\.").downcase | |
| puts word | |
| words[word]=words[word]||[0,[]] | |
| words[word][0]+=1 |
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
| # encoding: utf-8 | |
| text = %{Her mission may not have been accomplished though, as Styles took the high road when asked about Swift and her performance on a British radio show this week. | |
| "She's a great performer and she always performs great," he praised. "She's always good on the stage. She's been doing it a long time. She knows what she's doing on stage. It was just another good Taylor Swift performance." | |
| Swift and Harry Styles (Alequin/Bosch/INFDaily.com) | |
| He also wasn’t concerned about running into her at the Brit Awards, where they were both scheduled to perform on Wednesday night. | |
| "I'm not worried about seeing her at all," he recently told Grazia magazine. "She's a sweet girl, you know, I don't have a bad word to say about her." | |
| Despite Styles' good-guy vibe, it seems that Swift may have been trying to send more messages the One Direction singer’s way when she took the stage at the Brit Awards where Styles happened to be sitting in the audience. The blonde pranced around in a white poofy dress that looked |
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
| $.fn.drag = (options) -> | |
| defaults = | |
| handler: false | |
| opacity: 0.5 | |
| onlyX: false | |
| onlyY: false | |
| opts = $.extend(defaults, options) | |
| this.each -> | |
| isMove = false | |
| if opts.handler |
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
| #cover | |
| width: 600px | |
| padding: 40px | |
| position: absolute | |
| left: 0 | |
| -webkit-perspective: 920px | |
| -webkit-perspective-origin: 50% 50% | |
| .cover-frame | |
| position: relative | |
| width: 333px |
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
| $.fn.vod_player = (options) -> | |
| timeFormat = (seconds) -> | |
| m = if Math.floor(seconds/60) < 10 then ("0" + Math.floor(seconds/60)) else Math.floor(seconds/60) | |
| s = if Math.floor(seconds-(m*60)) < 10 then ("0" + Math.floor(seconds-(m*60))) else Math.floor(seconds-(m*60)) | |
| m + ":" + s | |
| defaults = | |
| width: 1280 | |
| height: 720 | |
| source: "http://itstreaming.apple.com/podcasts/apple_keynotes_1080p/2012_oct_1080_CC.m4v" | |
| type: 'video/mp4' |
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
| main = exports ? this | |
| main.searchLocations = (brand, cities...) -> | |
| a = "looking for #{brand} in #{cities.join(',')}" | |
| console.log(a) | |
| class main.Coffee | |
| constructor: (@name, @strength=1) -> | |
| $("i.icon-leaf").click => | |
| console.log(@name) | |
| brew: -> alert "brewing #{@name}" | |
| pour: (amount=@strength) -> |
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
| # Place all the behaviors and hooks related to the matching controller here. | |
| # All this logic will automatically be available in application.js. | |
| # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | |
| $ -> | |
| $("form#form_test").bind "ajax:success",(data, cdata, xhr) -> | |
| if cdata.status is 0 | |
| alert("ss") | |
| tmpl = $('#tmpl-item').html() | |
| todoItemHTML = (id, txt) -> |
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
| On only two scores can The Economist hope to outdo its rivals | |
| consistently. One is the quality of its analysis; the other is the quality | |
| of its writing. The aim of this book is to give some general advice on | |
| writing, to point out some common errors and to set some arbitrary | |
| rules. | |
| The first requirement of The Economist is that it should be readily | |
| understandable. Clarity of writing usually follows clarity of thought. | |
| So think what you want to say, then say it as simply as possible. Keep | |
| in mind George Orwell’s six elementary rules (“Politics and the English | |
| Language”, 1946): |
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 RecordingEpg | |
| RSID = "SCSP" | |
| TSID = "ISPACE DS" | |
| def self.get_epg(args={}) | |
| args = { | |
| :spid => $rca_config[:kuanyun_spid], | |
| :appid => $rca_config[:kuanyun_appid], | |
| :time_stamp => Date.today.to_time.strftime('%Y-%m-%d %H:%M:%S'), |