Skip to content

Instantly share code, notes, and snippets.

View loginx's full-sized avatar

Xavier Spriet loginx

View GitHub Profile

Keybase proof

I hereby claim:

  • I am loginx on github.
  • I am xspriet (https://keybase.io/xspriet) on keybase.
  • I have a public key ASDZRegHtifsrXrSz1bTuPvi16EhCVA759klbbbAGb08lAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am loginx on github.
  • I am xspriet (https://keybase.io/xspriet) on keybase.
  • I have a public key whose fingerprint is 6B56 B521 FBBB 2BA8 67CA C5B1 0323 EBA8 7D70 BBC3

To claim this, I am signing this object:

@loginx
loginx / CHANGELOG.md
Created June 11, 2015 15:15
Sample Changelog

2.7.1 - 2015-06-11

  • New stable release

2.7.1-rc1 - 2015-06-10

Bugfixes

  • Fix an issue where AX_ARIA_04 rule wouldn't be applied in certain contexts

2.7.1-rc0 - 2015-06-09

@loginx
loginx / .bashrc
Created November 1, 2013 04:39
Current git branch info in bash prompt.
# Insert this in ~/.bashrc or ~/.bash_login
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " ("${ref#refs/heads/}")"
}
export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\$(parse_git_branch) \$\[\033[00m\] "
@loginx
loginx / .bash_login
Created June 12, 2013 19:15
Show git branch in bash prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo " ("${ref#refs/heads/}")"
}
export PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\$(parse_git_branch) \$\[\033[00m\] "
@loginx
loginx / overlaps.jquery.coffee
Created November 29, 2012 23:44
jQuery $(el).overlaps(otherEl) helper
$.fn.overlaps = (el) ->
el = $(el)
o =
el1: @offset()
el2: el.offset()
el1 =
x1: o.el1.left
x2: o.el1.left + @width()
@loginx
loginx / containspoint.coffee
Created November 20, 2012 20:29
jQuery containsPoint method
# jQuery method to detect whether or not a point (x,y) is within the bounds of a jQuery element.
# Example usage: $("#container").containsPoint 100, 100
$.fn.containsPoint = (x, y) ->
(@offset.left < x < @offset.left + @width()) and
(@offset.top < y < @offset.top + @height())
@loginx
loginx / ie8.html
Created June 12, 2012 00:27 — forked from johnthethird/ie8.html
IE8 Batman Performance
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>Batman Profiler</title>
<script type="text/javascript" src="https://raw.github.com/Shopify/batman/master/lib/es5-shim.js"></script>
<script type="text/javascript" src="https://raw.github.com/Shopify/batman/v0.9.0/lib/batman.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"></script>
<script type="text/javascript" src="http://coffeescript.org/extras/coffee-script.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
@loginx
loginx / irb.rb
Created May 30, 2012 16:21
How to use make_flaggable with STI relations
User.find(1).flag Tablet.find(1)
# => #<MakeFlaggable::Flagging id: 1, flaggable_type: "Device", flaggable_id: 1, flagger_type: "User", flagger_id: 1, reason: nil, created_at: "2012-05-30 16:16:23", updated_at: "2012-05-30 16:16:23">
User.find(1).flagged? Tablet.find(1)
# MakeFlaggable::Flagging Load (0.4ms) SELECT "flaggings".* FROM "flaggings" WHERE "flaggings"."flagger_id" = 1 AND "flaggings"."flagger_type" = 'User' AND "flaggings"."flaggable_type" = 'Tablet' AND "flaggings"."flaggable_id" = 1 LIMIT 1
# => false
# :rage:
#########
# If you look at the query, it inserted the `flaggable_type` as 'Device', but is searching for 'Tablet'
@loginx
loginx / _partial1.html.erb
Created May 16, 2012 21:25
Dynamic partials in Batman.js
<div data-replace="item">
PARTIAL 1: <span data-bind="item.name"></span>
</div>