Skip to content

Instantly share code, notes, and snippets.

View loujaybee's full-sized avatar
🖥️
Codin'

Lou Bichard loujaybee

🖥️
Codin'
View GitHub Profile
@loujaybee
loujaybee / hooks.js
Created September 2, 2015 13:27
hooks
var now = (new Date()).getTime();
var meetings = {
0: {
startTime: new Date(now + 1000),
endTime: new Date(now + 2000)
},
1: {
startTime: new Date(now + 2000),
endTime: new Date(now + 3000)
@loujaybee
loujaybee / gist:75dbf692dbd6facbfdc3
Last active October 12, 2015 10:48
Errors in nested object property access

When getting this error:

errorStack: TypeError: Cannot read property 'length' of undefined 
at get (https://prodtest.mudano.com/core/tasks.data.service.js:9:37)

A solution to this type of error where properties are deply nested in object sub properties, and you're not sure if the property is set up yet is to use _.get

@loujaybee
loujaybee / gist:2e72b6f666fef94c9264
Created November 9, 2015 17:43
Angular watch and unwatch
// Wait for the value to be populated, initialise and then close
var setupWatch = scope.$watch('collectionToPopulate', function(){
if(!_.isEmpty(scope.collectionToPopulate)){
infinite_scroll.loadInitialElements();
infinite_scroll.setupInfiniteScrollToRunOnDelay();
setupWatch();
}
});
@loujaybee
loujaybee / Artur.js
Created January 10, 2016 14:42
Extracting html in node
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var runRegex = function(html) {
var extract_test_data = /(status_)(passed|failed)(.{16})([a-z]+)([0-9]+)(.{2})([0-9]{3})/gm;
var output = {};
while ((result = extract_test_data.exec(html)) != null) {
var getObjectProperties = function(prop){
console.log('arturs stuff', object[prop]);
};
var object = {
"test": "something",
"somethingelse": "artur"
}
getObjectProperties("test");
/*
fa-bug
fa-balance-scale
fa-list-ul
fa-plus
fa-times-circle
fa-bars
fa-book
fa-1
@loujaybee
loujaybee / gitbasics.md
Last active September 22, 2016 01:58
Git basics

Gotcha's / Things to watch out for

  • You're creating a new branch, all changes on this branch are different from changes on master
  • You can resolve this in a number of ways, for now just stay and work on the gh-pages branch for ease
  • It is generally good practice to keep 'master' as the source of truth, that's why it's master so we will cover merging things back to master eventually

Git basics: Setting up a github pages

Step 1: Create the repo online

box-sizing: border-box;

$(document).ready(function(){ console.log("Ready!")

for(var i = 1; i<=100; i++){

if(i % 3 === 0 &amp;&amp; i % 5 === 0){
@loujaybee
loujaybee / stripeCreateAccount.js
Created November 14, 2017 09:25
Stripe Create Account (NodeJS)
stripe.accounts.create({
email: "bob@bobsgym.com",
country: "gb",
type: "custom"
})