Skip to content

Instantly share code, notes, and snippets.

View dflynn15's full-sized avatar

Daniel Flynn dflynn15

View GitHub Profile
@dflynn15
dflynn15 / jquery.stateselector.js
Last active September 16, 2019 19:02
jQuery stateselector is a plugin that is given the state/province <select> field and dynamically populates it dependent on the country <select> field the plugin is attached to. Currently is using country codes, can be modified to take in string values of the countries on lines 97 and 104. To add more countries add a hash variable above $.fn.stat…
/**
*
* Created by: Daniel Flynn
* Date: Jan 17, 2013
* Updated: Jan 17, 2013
* jQuery plugin for a dynamic country/state select field
*
**/
(function($){
@dflynn15
dflynn15 / jquery.presenter.js
Last active December 14, 2015 19:09
jQuery plugin for a lazy loading "presenter." Based on the comp presenter here: http://blog.stevendesigns.com/comp-presenter-jquery-plugin/ Allows for both lists and div's to organize images or content. Current support is only for images. Content sniffing will be added later on in a GitHub repository.
/**
*
* Created by: Daniel Flynn
* Date: Mar 04, 2013
* jQuery plugin for a lazy loading slideshow
* Assumes that the slides or content is in order and has a data-src attribute.
*
* Currently is only working with images as content. Other file types will be added
* in as development continues
*
@dflynn15
dflynn15 / builder.rb
Created March 13, 2013 19:50
This is a Rails Application Generator that I commonly use. There are a lot of questions that prompt the user for feedback, and as I continue to develop more gems or Rails generators may be changed. For now it depends on the gem hub (install by running gem install hub).
class AppBuilder < Rails::AppBuilder
# Checks to make sure that hub is installed before continuing
def rakefile
if `which hub`.strip == ""
say "hub", "Please install hub. https://github.com/defunkt/hub"
exit 1
end
end
# Makes the readme use Markdown and pre-populates it with basic information
@dflynn15
dflynn15 / mixin.less
Last active August 29, 2015 14:00
Conditional Media Query Mixin for LESS.
/*
* This is a LESS port of Sparkbox's module-based media queries mixin in SASS
* https://github.com/sparkbox/SB-Media
*
* Example use: http://codepen.io/dflynn15/pen/AHadk
* body{
* background-color:red;
*
* .sb-media(40em ,{
* background-color: blue;
@dflynn15
dflynn15 / xampp.sh
Created June 16, 2014 21:00
Fun bash script to write to XAMPP vhost and add symbolic link.
#!/bin/bash
# Format of command: ./xampp.sh new.website.name.com projectDir path/to/project/Dir
# Number of expected arguments
EXPECTED_ARGS=3
function create_symbolic_link {
sudo ln -s $1 /Applications/XAMPP/xamppfiles/htdocs/$2
}
@dflynn15
dflynn15 / gulpfile.js
Last active August 29, 2015 14:10
Integration example of gulp-jasmine-phantom
var gulp = require('gulp');
var jasmine = require('gulp-jasmine-phantom');
gulp.task('default', function() {
return gulp.src('spec/test.js')
.pipe(jasmine({
integration: true
}));
});
@dflynn15
dflynn15 / gulpfile.js
Last active August 29, 2015 14:10
Asynchronous example of gulp-jasmine-phantom
var gulp = require('gulp');
var jasmine = require('gulp-jasmine-phantom');
gulp.task('unitTests', function () {
return gulp.src('spec/test.js')
.pipe(jasmine());
});
gulp.task('integrationTests', function() {
return gulp.src('spec/test.js')
@dflynn15
dflynn15 / gulpfile.js
Last active September 1, 2016 00:03
lcov-merger Gulp task
var gulp = require('gulp'),
merger = require ('lcov-result-merger');
gulp.task('merge-coverage', function() {
return gulp.src('./reports/coverage/**/lcov.info')
.pipe(merger())
.pipe(gulp.src('./reports/merged/'))
});
@dflynn15
dflynn15 / test.scss
Created January 12, 2015 16:49
Testing the formatting function in gists.
.hero {
// First, styles that all brands
// have in common.
// (The "shared stuff")
font-size: 2em;
font-weight: bold;
border: 1px solid;
// Next, brand-specific styles.
// (The "themed stuff")
@dflynn15
dflynn15 / Capital.rb
Created February 16, 2016 20:41
Observable "Hunger Games" pattern
Class Capital
attr_reader :contestants
def initialize()
@contestants = []
end
def register(NewContestant)
puts "#{NewContestant.name} has entered the game!"
@contestants >> NewContestant