Skip to content

Instantly share code, notes, and snippets.

View LayneSmith's full-sized avatar
🎯
Focusing

Layne Smith LayneSmith

🎯
Focusing
View GitHub Profile
//DISPLAY SHARED PAGE WITH ALL RESULTS
//FIND SPECIIFIC ENTRIES IN TABLES
appRouter.route('/know-me-2016/display/:first_list_id/:second_list_id?').get(function(req,res){
req.models.know_me_2016
.find({ or:
[{list_id: req.params.first_list_id}, {list_id: req.params.second_list_id}]
}) // Select list
.run(function(err, results){
if(err){
res.send(err); }
var weeks = [
"Giants",
"Redskins",
"Bears",
"49ers",
"Bengals",
"Packers",
"Bye",
"Eagles",
"Browns",
@LayneSmith
LayneSmith / google-spreadsheet.js
Created November 9, 2016 14:24
Retrieve Google Spreadsheets content
function buildList(spreadsheet) {
$.getJSON("https://spreadsheets.google.com/feeds/list/" + spreadsheet + "/od6/public/values?alt=json", function (data) {
//Insert the hed and dek divs.
$('#listContainer').html('<div id="hed"></div><div id="deck"></div>');
//In console, you can see what info is being returned so you know how to get at the info you need. Remove for deployment.
//console.log(data);
// BASIC
.container {
display:flex;
border:10px solid goldenrod;
height:500px;
flex-wrap: wrap;
}
.box {
width: 33.333333%;
}
@LayneSmith
LayneSmith / scss-notes.scss
Created March 15, 2017 21:33
SCSS cheat sheet
////////////////////
// IMPORTS
////////////////////
@import 'variables'; //imports _variables.scss
@import 'mixins';
////////////////////
// VARIABLES
////////////////////
$dmn-blue: #454545;
import $ from 'jquery';
import shuffle from 'lodash.shuffle';
import getdata from './import';
// import d3 from 'd3-fetch';
import './furniture';
const arr = ['a', 'b', 'c', 'd'];
console.log(shuffle(arr));
getdata((data) => {
@LayneSmith
LayneSmith / console.js
Created April 27, 2017 05:50
Useful console methods
// Paste any snippet into a console window to see it in action.
// You can filter all these in console, ie: just show info etc...
console.log('This is a plain log'); // Plain log
console.warn('This is a warning'); // Yellow with warning
console.error('This is an error'); // Red with warning
console.info('This is info'); // Blue with info
console.debug('This is debug'); // Plain log BUT type is also blue
// String substitution
# install virtualenv
pip install virtualenv
# create a virtualenv called "django-env"
# with no site packages or furniture
virtualenv --no-site-packages django-env
# activate the virtualenv
source django-env/bin/activate
@LayneSmith
LayneSmith / promises.js
Created May 3, 2017 19:45
Basic promise structure
///////////////////////////////////////////////////
// LOAD FILES FROM SONGS LIST
///////////////////////////////////////////////////
let initialFunction = function () {
return new Promise((resolve, reject) => {
console.log('%cinitialFunction....', "color: purple; font-size: 24px;");
resolve('initialFunction COMPLETE');
});
};
let function1 = function () {
@LayneSmith
LayneSmith / inheritance.js
Created May 3, 2017 19:47
Holding for inheritance work
// function Dog(name, breed) {
// this.name = name;
// this.breed = breed;
// }
//
// Dog.prototype.bark = function () {
// console.log(`Bark Bark! My name is ${this.name}`);
// };
// Dog.prototype.cuddle = function () {
// console.log('I love you, owner!');