Skip to content

Instantly share code, notes, and snippets.

View msroot's full-sized avatar
:octocat:

Yannis Kolovos msroot

:octocat:
View GitHub Profile
@msroot
msroot / gist:3224209
Created August 1, 2012 06:16
bind all rails htr
$('html')
.bind("ajax:beforeSend", function(evt, xhr, settings){
console.log("ajax:beforeSend");
})
.bind("ajax:success", function(evt, data, status, xhr){
console.log("ajax:success");
})
.bind("ajax:error", function(evt, xhr, status, error){
console.log("ajax:error");
});
(1..3).each do |index|
b = Bucket.find(index)
b.is_linear.should_not == send(:"bucket_#{index}_before").is_linear
# b.is_default_active.should_not == bucket_1_before.is_default_active
# b.is_default_active.should_not == bucket_1_before.is_default_active
end
@msroot
msroot / gist:3325816
Created August 11, 2012 17:11 — forked from kevindavis/gist:1868651
Bootstrap styling for jQuery UI autocomplete
.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@msroot
msroot / gist:3529732
Created August 30, 2012 14:34
hot keys
jQuery.hotkeys = {
version: "0.8",
specialKeys: {
8: "backspace",
9: "tab",
13: "return",
16: "shift",
17: "ctrl",
18: "alt",
19: "pause",
@msroot
msroot / jQuery.ajaxQueue.min.js
Created August 30, 2012 15:12 — forked from gnarf/jQuery.ajaxQueue.min.js
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
\Faker\Address::address();
\Faker\Address::streetName();
\Faker\Address::streetAddress($includeSecondary = false);
\Faker\Address::city();
\Faker\Address::state();
\Faker\Address::stateAbbr();
\Faker\Address::zipCode();
\Faker\Address::zip();
\Faker\Address::postcode();
\Faker\Address::cityStateZip();
@msroot
msroot / gist:3840320
Created October 5, 2012 14:59
Fix modal for phone devices (@media (max-width: 480px))
/*MODAL FIXES*/
@media (max-width: 480px) {
.modal {
height: 500px; /* Set a default max height of the modal (adjusted later)*/
position: fixed; /* Display modal in the centre of your screen */
overflow-y: scroll; /* Ensure that the modal is scroll-able */
-webkit-overflow-scrolling: touch; /* Avoid having to use 2 finger scroll on iOS */
}
.modal.fade.in{
top: 5px;
@msroot
msroot / gist:3854194
Created October 8, 2012 18:52
ie css
background: white; /* all browsers */
*background: black; /* will show black on ie7 only */
_background: blue; /* will show blue on ie 6 only */
@msroot
msroot / gist:3861361
Created October 9, 2012 20:54
rails errors
<% if @entry.errors.include?(:state) %>
<div class="control-group">
<div class="controls">
<div class="error"> <%= @entry.errors["state"][0] %></div>
</div>
</div>
<% end %>
###############OR
@msroot
msroot / gist:3869398
Created October 11, 2012 00:26
Fix iphone autocomplete - autocorrect -autocapitalize
function fix_iphone_autocomplete(){
$("#entry_captcha").attr('autocorrect','off');
$("#entry_captcha").attr('autocomplete','off');
$("#entry_captcha").attr('autocapitalize','off');
}