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
## Try 1 | |
# How could I get the following working nicely | |
Date.strptime("Ven 13 Mai. 2011, 16h00", "%a %d %b %Y, %Hh%M") | |
# I've tried to update Date::ABBR_DAYNAMES as follow | |
I18n.locale = :fr | |
Date::ABBR_DAYNAMES = I18n.t('date.abbr_day_names') | |
Date::ABBR_MONTHNAMES = I18n.t('date.abbr_month_names') |
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
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("BookingSyncCalendarWidget",[],t):"object"==typeof exports?exports.BookingSyncCalendarWidget=t():e.BookingSyncCalendarWidget=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/assets/",t(t.s=13)}([function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"g",function(){return d}),n.d(t,"n",function(){return u}),n.d(t,"l",function(){return g}),n.d(t,"c",function(){return h}) |
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 "slack-ruby-client" | |
token = ... | |
user_name = ... | |
Slack.configure do |config| | |
config.token = token | |
end | |
client = Slack::Web::Client.new |
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
# | |
# Cookbook Name:: whenever | |
# Recipe:: default | |
# | |
ey_cloud_report "whenever" do | |
message "starting whenever recipe" | |
end | |
if node[:instance_role] == 'solo' || | |
(node[:utility_instances].length > 0 && node[:utility_instances][0][:name] == node[:name]) || |
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
// Currently used with the bookmarklet http://www.paulirish.com/2008/bookmarklet-inject-new-css-rules/ | |
.card { padding: 0 0 0 4px; margin-bottom: 0; border-bottom: 0 } | |
.card .title { | |
font-size: 12px; | |
line-height: 14px; | |
} | |
.card .hb-avatar-tooltip, .card .number { display: none; } |
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
$.fn.extend | |
myplugin: (options) -> | |
self = $.fn.myplugin | |
opts = $.extend {}, self.default_options, options | |
$(this).each (i, el) -> | |
self.init el, opts | |
self.log el if opts.log | |
$.extend $.fn.myplugin, | |
default_options: |
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
# | |
# Cookbook Name:: env_vars | |
# Recipe:: default | |
# | |
if ['solo', 'app', 'app_master', 'util'].include?(node[:instance_role]) | |
execute "reload-nginx" do | |
action :nothing | |
command "/etc/init.d/nginx reload" |
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
describe "POST to #create" do | |
# Will use the file located at rspec/fixtures/files/test-document.pdf | |
let(:attachement) { fixture_file_upload('/files/test-document.pdf', "text/pdf") } | |
before do | |
post :create, attachment: {title: "Attachment Title", attachment: file_attachment} | |
end | |
it {should redirect_to some_path } | |
end |
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 'benchmark' | |
require 'nokogiri' | |
n = 50000 | |
Benchmark.bm do |x| | |
x.report { doc = Nokogiri::HTML::DocumentFragment.parse("<p>Foo Bar</p> <p>bar bar bar</p> <p>bla</p>") ; doc.children.map{|node| node.to_s.strip}.compact.join } | |
x.report { doc = Nokogiri::HTML::DocumentFragment.parse("<p>Foo Bar</p> <p>bar bar bar</p> <p>bla</p>") ; doc.children.each { |node| next_node = node.next_sibling ; next_node.remove if next_node && next_node.text.strip == '' } } | |
x.report { doc = Nokogiri::HTML("<p>Foo Bar</p> <p>bar bar bar</p> <p>bla</p>") ; doc.search('p').each { |node| next_node = node.next_sibling ; next_node.remove if next_node && next_node.text.strip == '' } } | |
end |
NewerOlder