Skip to content

Instantly share code, notes, and snippets.

View neenjaw's full-sized avatar
:shipit:
Shippin' code

Tim Austin neenjaw

:shipit:
Shippin' code
View GitHub Profile
@echo on & @setlocal enableextensions
@echo =========================
@echo Turn off the time service
net stop w32time
@echo ======================================================================
@echo Set the SNTP (Simple Network Time Protocol) source for the time server
w32tm /config /syncfromflags:manual /manualpeerlist:"0.it.pool.ntp.org 1.it.pool.ntp.org 2.it.pool.ntp.org 3.it.pool.ntp.org"
@echo =============================================
@echo ... and then turn on the time service back on
net start w32time
@neenjaw
neenjaw / ex.js
Created January 17, 2018 20:08
JS for setting mouse-x/y css3 variable
var root = document.documentElement;
document.addEventListener("mousemove", evt => {
let x = evt.clientX / innerWidth;
let y = evt.clientY / innerHeight;
root.style.setProperty("--mouse-x", x);
root.style.setProperty("--mouse-y", y);
});
@neenjaw
neenjaw / scrolling.js
Created January 17, 2018 20:24
JS for defining CSS3 variable --scroll, to make effects based on the scroll of a window
//put in function to be executed once elements with class="scrolling" have loaded
for (let el of document.querySelectorAll(".scrolling")) {
el.addEventListener("scroll", evt => {
let maxScroll = el.scrollHeight - el.offsetHeight;
let scroll = el.scrollTop / maxScroll;
el.style.setProperty("--scroll", scroll);
});
}
// Put in CSS rules.
@neenjaw
neenjaw / auth.js
Created February 25, 2018 22:03
passport-local-mongoose authenticate example
//USER SCHEMA
const mongoose = require('mongoose');
const passportLocalMongoose = require('passport-local-mongoose');
module.exports = (function () {
const userSchema = mongoose.Schema({
username: String,
password: String,
.toggle-content {
display: none;
height: 0;
overflow: hidden;
transition: height 350ms ease-in-out;
}
.toggle-content.is-visible {
display: block;
height: auto;

CSS3 fade in & slide out transition

Really, really simple demo of a slide out transition with a fade in.

A Pen by Tim Austin on CodePen.

License.

@neenjaw
neenjaw / grapharc.mlx
Created March 23, 2018 11:16
Matlab arc graph
s = 763; % actual score
smin = 250.0; %min FICO
smax = 900.0; %max FICO
%aesthetic constants
k = 0.78;
k2 = (k+1.0)/2.0;
theta0=28.0; %the big arc covers 360-2*theta0 degrees
%the big arc
theta = [theta0:0.1:360.0-theta0] - 90.0;
@neenjaw
neenjaw / pagination.ejs
Created April 11, 2018 18:07
Pagination template implemented in EJS
<div class="row text-center">
<% if (pages && pages > 0) { %>
<ul class="pagination text-center">
<% if (current == 1) { %>
<li class="disabled"><a>First</a></li>
<% } else { %>
<li><a href="/campgrounds<%if(search){%>?search=<%=search%><%}%>">First</a></li>
<% } %>
<% if (current == 1) { %>
@neenjaw
neenjaw / app.js
Created May 28, 2018 13:19
Starter - Node/Express/MongoDB/Mongoose/EJS/Passport
// ============================
// Node Requires
// ============================
const express = require('express');
const mongoose = require('mongoose');
// const flash = require('express-flash-2'); // flash messaging helper library
// const methodOverride = require('method-override'); // allow UPDATE and DELETE to be routed from POST forms
// const expressSanitizer = require('express-sanitizer'); // sanitize input for injection protection
# Initialize the zero-valued list with 100 length
zeros_list = [0] * 100
# Declare the zero-valued tuple with 100 length
zeros_tuple = (0,) * 100
# Extending the "vector_list" by 3 times
vector_list = [[1, 2, 3]]
for i, vector in enumerate(vector_list * 3):
print("{0} scalar product of vector: {1}".format((i + 1), [(i + 1) * e for e in vector]))