Skip to content

Instantly share code, notes, and snippets.

View alexparker's full-sized avatar
♻️
Who → Why → How → What

Alex Parker alexparker

♻️
Who → Why → How → What
View GitHub Profile
@alexparker
alexparker / groove-widget.md
Created April 5, 2014 00:40
Groove Utility Methods

If you are loading the GrooveWidget code inside your <body>...</body> tag like this:

    ...other body content...
    <script type='text/javascript'>
      //<![CDATA[
        (function() {var s=document.createElement('script');
          s.type='text/javascript';s.async=true;
          s.src=('https:'==document.location.protocol?'https':'http') +
          '://YOURSUBDOMAIN.groovehq.com/widgets/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ticket.js'; var q = document.getElementsByTagName('script')[0];q.parentNode.insertBefore(s, q);})();

//]]>

@alexparker
alexparker / 0_reuse_code.js
Created April 2, 2014 16:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
class Thing
attr_accessor :quantity
def initialize
@quantity = 100
end
def decrement(qty)
difference = quantity - qty
quantity = difference
end
@alexparker
alexparker / gist:6595050
Created September 17, 2013 14:27
unicorn config
# Change paramentres below to appropriate values and set CONFIGURED to yes.
CONFIGURED=yes
# Default timeout until child process is killed during server upgrade,
# it has *no* relation to option "timeout" in server's config.rb.
TIMEOUT=60
# Path to your web application, sh'ld be also set in server's config.rb,
# option "working_directory". Rack's config.ru is located here.
APP_ROOT=/home/rails
@alexparker
alexparker / acts_as_paranoid-has_many_through-usage.md
Created January 6, 2013 22:17
acts_as_paranoid for has_many :through

I am using the acts_as_paranoid gem to manage soft deletion

Ah ok. I have an association that is

(in user.rb)
has_many :files, :through => :folders

and i am calling

user.files.select(...).where(...).group(...)
@alexparker
alexparker / current-media-queries.scss
Created November 4, 2012 03:55
SASS Proposition for extending media queries via output buffer style functions
/*
I understand this is how it currently works.
Also there is a little "convenience" way to do it with some control structures and passing an argument to the mixin,
but the resulting code is still the same.
*/
@mixin handhelds() {
@media only screen and (max-width: 479px) { @content; }
}
@alexparker
alexparker / typetest-hack.js
Last active October 7, 2015 10:37
Javascript exercises
var xi = 0;
var evnt = jQuery.Event('keyup');
evnt.keyCode = evnt.which = 32;
function enterWord(){
$('input#inputfield').val($('.highlight').text());
$('input#inputfield').trigger(evnt);
}
var wpm = prompt("How many words per minute would you like?");