Skip to content

Instantly share code, notes, and snippets.

View pretentiousgit's full-sized avatar

Alex Leitch pretentiousgit

View GitHub Profile
@pretentiousgit
pretentiousgit / indexMaker.js
Last active December 28, 2023 14:14
Node.js index generator for front-end component libraries
import fs from 'fs';
import path from 'path';
const folder = `${path.resolve()}/`;
const scriptName = 'indexMaker.js';
console.log(folder);
console.log(scriptName);
/*
@pretentiousgit
pretentiousgit / delete_slack_images
Last active December 8, 2019 17:15
Slack Deletron plugin to automate item deletion
let arr = Array.from(document.querySelectorAll('.File__Button'));
console.log(arr.length);
(function loopClick (i) {
setTimeout(function () {
console.log('loop i', i)
if(arr[i - 1]){
arr[i - 1].click()
arr = Array.from(document.querySelectorAll('.File__Button'));
}
Hel-LO. No. I have no feminist things in New York, which is a horrifying place I love fully, but here are some things you will find engaging!
1. You should find a Donut Plant and eat a coconut cream donut, unless you hate coconut so much you really can't cope. If you can drink coconut _water_ even, these are great. All their donuts are great. Oatmeal is the other best.
2. I don't know where you're staying, but if you wanna feel fancy, go to Freeman's Bar http://www.freemansrestaurant.com/.
3. I don't know if you like shoes, but Trippen, the weird German shoe company with the amazing boots, has a location in Soho. I love them, they cost more than ETH.
4. Prospect Park zoo is beautiful but it's also a zoo!
HOW 2 GREP SOMETHING
find /etc /home /var /tmp -type f -exec grep -q 'helloiamstring' '{}' ';' -print
find / -not -path '/tmp/*' …rest of predicates…
find / -type f -exec grep 'helloiamstring' '{}' '+'
@pretentiousgit
pretentiousgit / gist:4c7cf4650ce23dcc1243a8844c57805e
Created February 2, 2018 22:48
output of vagrant fail on mac
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Running provisioner: shell...
default: Running: /var/folders/rj/00wvz12s67727s2kty1w5dy80000gp/T/vagrant-shell20180202-46524-hf0r7s.sh
default: Ign http://us.archive.ubuntu.com precise InRelease
default: Hit http://us.archive.ubuntu.com precise-updates InRelease
default: Hit http://us.archive.ubuntu.com precise-backports InRelease
default: Hit http://us.archive.ubuntu.com precise Release.gpg
default: Ign http://ppa.launchpad.net precise InRelease
default: Hit http://security.ubuntu.com precise-security InRelease
default: Hit http://us.archive.ubuntu.com precise-updates/main Sources
// db.js
'use strict';
var mongoose = require('mongoose');
var db = mongoose.createConnection('mongodb://127.0.0.1:27017/YOUR_APP_NAME');
var auth_db = db.useDb('users');
module.exports = {auth: auth_db, db: db};
@pretentiousgit
pretentiousgit / gist:53064db01118fed66d50
Last active August 29, 2015 14:06
Populate grandchildren in arrays, Mongoose 3.8.x
Parent.findById(req.params._id).populate('children').exec(function(err, doc){
// note that you have to populate the children here
// or they won't turn up properly later
// even if you substitute all of them with a new document set.
Child.find({'_parent':req.params._id}).populate('grandchildren').exec(function(err, docs){
// note that the child has to know it belongs to the parent in its own schema
// this is technically a totally separate document set.
if(err) res.send(err);
Child.populate(docs, {path: 'grandchildren.greatGrandChildren', model:'GreatGrandChild'}, function(err, data){
@pretentiousgit
pretentiousgit / ContentQueryTableMaker
Created July 15, 2013 21:00
Content Query Webpart to spit out table of all PDF and Doc files in SP site. Table designed to be copied and pasted into Excel by Excel users with access to SP.
<xsl:stylesheet
version="1.0"
exclude-result-prefixes="x xsl cmswrt cbq"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime"
xmlns:cbq="urn:schemas-microsoft-com:ContentByQueryWebPart">
<xsl:output method="xml" indent="no" media-type="text/html" omit-xml-declaration="yes"/>
<xsl:param name="cbq_isgrouping" />
<xsl:param name="cbq_columnwidth" />
@pretentiousgit
pretentiousgit / Sharepoint 2010 CQWP DebugMode XSL
Last active March 28, 2018 19:52
Sharepoint 2010 CQWP debug mode, based on Heather Solomon's customizations. Add to ItemStyle.xsl for instant reveal of what your CQWP is actually rolling up.
<xsl:template name="DebugMode" match="Row[@Style='DebugMode']" mode="itemstyle">
<xsl:for-each select="@*">
P:<xsl:value-of select="name()" /> T:<xsl:value-of select="@*" /> V:<xsl:value-of select="." /><br />
</xsl:for-each>
<br />
<br />
</xsl:template>
@pretentiousgit
pretentiousgit / CleanBulletsXSL
Last active December 16, 2015 09:58
XSL to produce clean bulleted list for Sharepoint 2010 Table of Contents webpart
/// HERE IS YOUR CSS
/* TOC webpart style */
.level-section-header {
font-size: 14px; font-weight:bold;margin:5px;
}
.level-section-fresh{ /* .level-section is set inline in TOC pages, so .level-section-fresh is a new class added to LevelStyle.xsl VerticalBullet (custom) to bypass */
margin:1px 0px 0px 15px;
border-style: none;
border-color: inherit;