Skip to content

Instantly share code, notes, and snippets.

View kyleknighted's full-sized avatar

Kyle Knight kyleknighted

View GitHub Profile
class CsvFile < ActiveRecord::Base
belongs_to :user
require "CSV"
has_attached_file :csv_file,
:path => ":rails_root/public/system/csvfile/:id/:filename",
:url => "/system/csvfile/:id/:filename"
after_create :parse_csv
def parse_csv
class Mapping < ActiveRecord::Base
belongs_to :user
require "CSV"
has_attached_file :csv_file,
:path => ":rails_root/public/system/mapping/:id/:filename",
:url => "/system/mapping/:id/:filename"
# after_create :create_csv
def get_csv_headers
@kyleknighted
kyleknighted / bouncebreak.coffee
Created May 18, 2012 19:25
Hubot Random Bouncebreak.com Image
# Bounce Break script
#
# bounce me - Send a random bouncebreak.com image
htmlparser = require "htmlparser"
module.exports = (robot) ->
robot.respond /(bounce|bouncebreak)( me)?/i, (msg) ->
bounceBreakCall msg, (image_url) ->
msg.send image_url
for(var person in myChair){
alert('GET OUT OF MY CHAIR!!!');
// http://www.hark.com/clips/spytzjhbxv-outta-my-chair
}
<div class="span4">
<ul class="left-nav">
<li class="btn btn-large vendor-action" id="btn-news" data-action="news">Latest News</li>
<li class="btn btn-primary btn-large vendor-action" id="btn-redeem" data-action="redeem">Redeem Gift Certificate</li>
<li class="btn btn-primary btn-large vendor-action" id="btn-check" data-action="check">Check Balance</li>
<li class="btn btn-primary btn-large vendor-action" id="btn-outstanding" data-action="outstanding">Outstanding Balance</li>
</ul>
</div>
<div class="span8">
<div id="news">
@kyleknighted
kyleknighted / gist:4066273
Created November 13, 2012 15:18
Purge Keys from Redis with Pattern
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
@kyleknighted
kyleknighted / gist:4487916
Created January 8, 2013 21:01
Current Settings for Sublime Text 2
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/cobalt2.tmTheme",
"dictionary": "Packages/Language - English/en_GB.dic",
"fade_fold_buttons": false,
"font_face": "Menlo",
"font_size": 16.0,
"highlight_line": true,
"ignored_packages":
[
@mixin retina-image($img, $img-hires) {
background: url(/images/#{$img}) no-repeat center center !important;
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -moz-min-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
only screen and ( min-device-pixel-ratio: 2),
only screen and ( min-resolution: 192dpi),
only screen and ( min-resolution: 2dppx) {
@kyleknighted
kyleknighted / Attribute Watcher.js
Last active December 12, 2015 10:18
an all platform mutation observer that has never been tested - so use at your own risk `attrWatcher.watch(objArray, callbackFunction);`
var attrWatcher = (function() {
"use strict";
var isDOMAttrModifiedSupported, MutationObserver, attrchange, observer, disconnect;
isDOMAttrModifiedSupported = function() {
var p = document.createElement('p');
var flag = false;
if (p.addEventListener) p.addEventListener('DOMAttrModified', function() { flag = true }, false);
@kyleknighted
kyleknighted / put-it-back.coffee
Created February 25, 2013 17:34
Hubot - Put It Back script
# put back the table
#
# flip a table and the bot cleans up the rooms
module.exports = (robot) ->
robot.hear /(╯°□°)╯︵ ┻━┻|\(╯°□°)╯︵ ┻━┻|\(ノಠ益ಠ\)ノ彡┻━┻/i, (msg) ->
msg.send('┬──┬ ノ( ゜-゜ノ)')