Skip to content

Instantly share code, notes, and snippets.

View abhinayar's full-sized avatar

Abhi Nayar abhinayar

View GitHub Profile
/**
* FUNCTION = (inputData) => string
* Creates the lesson slug based on the data passed in
* --
* Takes in all the inputData we are working with and uses the title, composer name,
* artist name and other information to construct the slug which we use in the lesson
* URL, i.e. https://tonebase.co/lessons/preview/__________ (ex: leo-brouwer-teaches-estudios-sencillos-by-leo-brouwer)
*/
function constructSlug(inputData) {
// == EXTRACT DATA FROM INPUT DATA
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
// NOTE:
// To omit any section, simply set it to be null
// Like so... blogPosts: null
module.exports = {
general: {
// List the issue #
// Check last weeks newsletter if you need a refresher on the number
issue: 55,
// Breifly describe the content of this newsletter
// - note, you might need to load the page once before you do this...
axios.get('https://medium.com/@tonebaseteam/latest?format=json').then(function (html) {
// First we get the HTML version of the json results
let unParsedData = html.data.toString();
//console.log(unParsedData)
// Now we need to strip the CORS security buffer used by Medium
// I.E. they add "])}while(1);</x>" to the beginning of each response
// so you cant just simply parse the JSON data
unParsedData = unParsedData.slice(16, unParsedData.length);
//console.log(unParsedData);
stopBodyScrolling(bool) {
if (bool === true) {
document.body.addEventListener("touchmove", (e) => {
e.preventDefault()
}, false);
} else {
document.body.removeEventListener("touchmove", (e) => {
e.preventDefault()
}, false);
}
@abhinayar
abhinayar / pca.m
Created November 11, 2017 06:13
PCA.m (Principle Component Analysis in Matlab)
function [components variances] = pca(X, m)
close all
% We start yby calcing the mean
% This gives us a 1 x i matrix with the average of all i rows of an image
meanX = mean(X);
% Now iterate through X and center the values
for i = 1:size(X,1)
for j = 1:size(X,2)