Skip to content

Instantly share code, notes, and snippets.

@BriceShatzer
BriceShatzer / Notes
Last active August 29, 2015 13:56
Unlimited item list
Set up as an independent page that uses no template. It can be loaded in using
$.ajax({
url: "itemList.html",
success: function (data) {
//do what ever you want with the data
},
dataType: 'html'
});
$.when(
$.ajax({
url: '/path/to/file',
dataType: 'html'
}).done(function(data) {
//do stuff
});
$.ajax({
url: '/path/to/file2',
# regex for sublime - clearing out dreamweaver templating from BC pages
#find:
(?s).+<!-- InstanceBeginEditable name="ContentArea" -->(.+)<!-- InstanceEndEditable -->.+
#replace:
$1
@BriceShatzer
BriceShatzer / gist:9654902
Last active August 29, 2015 13:57
START Group Instructor Portal | Snippets
/* ----- building JSON objects out of training modules ----- */
// step 1 - add jQuery
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
//step 2 - add some handles
$('#subrightcol>div div').eq(2).attr('id', 'left');
$('#subrightcol>div div.training_completedInfo').attr('id', 'right');
//clearing out training items
//set Altair 4x checkbox & datetime
document.getElementById('ctl00_cp_cat125506cat430727cat3').checked = false
document.getElementById('ctl00_cp_cat125506cat430728cat4').value = ''
//set Altair 5x checkbox & datetime
document.getElementById('ctl00_cp_cat125506cat430729cat3').checked = false
document.getElementById('ctl00_cp_cat125506cat430730cat4').value = ''
@BriceShatzer
BriceShatzer / gist:3deee6c7e87fda1dd974
Created December 22, 2014 22:27
Shimming for the broken /deep/ selector in sass
var styleSheet = $.grep(document.styleSheets, function(styleSheet){
return /assets\/css\/main.css/.test(styleSheet.href)
})[0]
$.grep(styleSheet.cssRules, function(rule){
return /isbn-prices/.test(rule.selectorText)
}).forEach(function(ruleToAdd){
var modified_selector;
var original_selector = ruleToAdd.selectorText;
var style = ruleToAdd.style.cssText;
@BriceShatzer
BriceShatzer / gist:7f789cd31a6110b64eac
Created May 4, 2015 19:03
angular-credit-cards issue
Possible issue within https://github.com/bendrucker/angular-credit-cards
Credit Card pattern regex is too inclusive
This allows
changing to [0-9\s\-]
still allows for spaces and dashes(something that is implied to be allowed by the docs) but prevents other characters.
Currently, all characters are allowed as long as they fall in amongst a valid card number.
@BriceShatzer
BriceShatzer / instructions.md
Last active August 29, 2015 14:26
Getting projects running locally w/ apache & webmin
  1. clone repo
  2. composer install / npm|bower install -> grunt|grunt
  3. edit /etc/hosts -> add new domain
  4. update webmin (http://localhost:10000/)
  5. apache webserver -> create new virtual host
  6. edit directives -> copy/add:
AllowOverride all
allow from all
Options -Indexes +FollowSymLinks
"font_face": "Consolas",
"font_size": 13,
---
"font_face": "Monospace Regular",
"font_size": 12,
---
"font_face": "Droid Sans Mono",
"font_size": 12/13,
---
"font_face": "FreeSans Mono",
var finalhandler = require('finalhandler');
var http = require('http');
var serveStatic = require('serve-static');
var request = require('request');
var fs = require('fs');
var serve = serveStatic('public');
request('http://api.dronestre.am/data').pipe(fs.createWriteStream('public/data.json'));
//request.get('http://api.dronestre.am/data').pipe(request.put('localhost:8080/livedata.json'));