Skip to content

Instantly share code, notes, and snippets.

// -- datepicker --
// booking
$('#booking_start_date').datepicker({
onSelect: function(dateText, inst) {
$('#booking_end_date').datepicker("option", 'minDate', new Date(dateText));
},
beforeShowDay: disableUnavailableDays,
dateFormat: 'dd-mm-yy'
});
$('#booking_end_date').datepicker({
@jhilden
jhilden / input-placeholder_mixin.sass
Created April 16, 2011 08:43
A SASS mixin to set all the different (pseudo-) classes to style the color of placeholder text in e.g. an input field. What other styles besides color would be interesting?
@mixin input-placeholder($color)
&.placeholder
color: $color
&:-moz-placeholder
color: $color
&::-webkit-input-placeholder
color: $color
@jhilden
jhilden / yamltester.rb
Created May 26, 2011 13:31
YAML tester
require 'rubygems'
require 'yaml'
YAML::ENGINE.yamler = 'psych'
Dir["**/*.yml"].each do |file|
puts file
YAML.load_file file
end;0
@jhilden
jhilden / ruby_string_include_array.rb
Created August 30, 2011 16:02
[Ruby] String.include?([Array])
# I find myself constantly wanting to check whether one string is included within an array of strings.
# It is certainly possible (and also fast) to do that in Ruby with something like this: ["foo", "bar"].include?("foo")
# But I don't think it reads very nice :(
# Because what I actually want to test is, whether my string is included in the array and NOT the other way around.
# - Do you have the same problem?
# - What do you think about the following two solutions?
class String
# create a new method
@jhilden
jhilden / curl_output
Created March 27, 2012 08:05
curl to with special HTTP accept header
curl -v -H "Accept: text/javascript, text/html, application/xml, */*" http://localhost:3000/places/12356-apartment-berlin-prenzlauerberg/calendar\?for_date\=2012-05-01
* About to connect() to localhost port 3000 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /places/12356-apartment-berlin-prenzlauerberg/calendar?for_date=2012-05-01 HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: localhost:3000
> Accept: text/javascript, text/html, application/xml, */*
>
< HTTP/1.1 200 OK
@jhilden
jhilden / tabs.js.coffee
Created August 28, 2012 10:33
Remove jquery-ui styling for tabs
$ ->
jquery_ui_classes = [".ui-tabs", ".ui-tabs-nav", ".ui-tabs-panel", ".ui-widget", ".ui-widget-header", ".ui-widget-content", ".ui-corner-all", ".ui-corner-top", ".ui-corner-bottom", ".ui-helper-clearfix", ".ui-helper-reset", ".ui-state-default"]
$(".js-tabs").tabs().each ->
# removes all the jquery-ui specific classes (except ones like ui-state-active)
$elements = $(this).find( jquery_ui_classes.join(", ") ).andSelf()
$elements.removeClass( jquery_ui_classes.join(" ").replace(/\./g, "") )
.icons-sprite
.icons-ad
.icons-add-small
.icons-add-tiny
.icons-ae
.icons-af
.icons-ag
.icons-ai
.icons-al
.icons-alert-error
@jhilden
jhilden / SassMeister-input.sass
Created February 23, 2013 20:21
Generated by SassMeister.com, the Sass playground.
// Sass v3.2.5
.context-a, .context-b
border: 1px
.some-class
color: red
.another-class
color: blue
@jhilden
jhilden / discourse_sso.rb
Last active June 16, 2018 04:11
# Discourse SSO Rails::Engine gem to perform cookie-based SSO login in [Discourse](http://www.discourse.org/). It expects your main app to set a cookie readable by Discourse with a Discourse `user_id` as the value (encrypting the value is a very good idea). See: http://meta.discourse.org/t/give-me-those-authentication-hooks-d/3943
module DiscourseSso
module ControllerExtensions
def self.included(klass)
klass.append_before_filter :ensure_sso_login
end
private
@jhilden
jhilden / _action_button.md
Last active December 29, 2015 06:29
Livingstyleguide integration

// app/assets/stylesheets/modules/_action_button.css.ass

Action Button

Button style usually used for call to actions::

<button type="button" class="***m-action_button***">Action button</button>
<a class="***m-action_button***">Action button</a>