Skip to content

Instantly share code, notes, and snippets.

View LayneSmith's full-sized avatar
🎯
Focusing

Layne Smith LayneSmith

🎯
Focusing
View GitHub Profile
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 / scss-notes.scss
Created March 15, 2017 21:33
SCSS cheat sheet
////////////////////
// IMPORTS
////////////////////
@import 'variables'; //imports _variables.scss
@import 'mixins';
////////////////////
// VARIABLES
////////////////////
$dmn-blue: #454545;
// BASIC
.container {
display:flex;
border:10px solid goldenrod;
height:500px;
flex-wrap: wrap;
}
.box {
width: 33.333333%;
}
@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);
var weeks = [
"Giants",
"Redskins",
"Bears",
"49ers",
"Bengals",
"Packers",
"Bye",
"Eagles",
"Browns",
//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); }
//Create a new repository
git init
//Start copy from github
git clone https://github.com/LayneSmith/shotput.git
//Fetch and merge changes on remote server to your working directory
git pull
//List all remote and local branches
git checkout <branch name>
git add .
git commit -m "enter a commit message"
git checkout master
git merge <branch name>
git add .
git commit -m "merged"
git push origin master
///Branching an existing branch
git pull origin <original branch name>
git checkout <original branch name>
git checkout -b <new branch name>
# Edit some files
git add .
git commit -m “Added some stuff”
git push origin <new branch name>
@LayneSmith
LayneSmith / check.php
Created June 18, 2015 13:39
Check SQL in PHP
$sql = "SELECT COUNT(*) FROM " . $thisTable . " WHERE ip = '$ip'";
echo $sql;
$res = $db->query($sql);
if (! $res) {
print_r($db->errorInfo());
}
$duplicateIP = $res->fetchColumn();