Skip to content

Instantly share code, notes, and snippets.

@wayspurrchen
wayspurrchen / git patterns.md
Last active Aug 28, 2021
Useful Git Techniques
View git patterns.md

History

Show file at certain commit

git show <hash>:<file>

Show history of a file

git log -p <filename>

@wayspurrchen
wayspurrchen / gist:b6fd4eb085edf54406b7
Last active Aug 14, 2021
Web Performance Optimization Techniques
View gist:b6fd4eb085edf54406b7
View duplicate_id :(
NOTE duplicate id 1545839157538981467
https://api-staging.realmassive.com/leases?sort=-updated&page[limit]=10&page[offset]=10
{
"meta":{
"count":125317
},
"data":[
{
"relationships":{
@wayspurrchen
wayspurrchen / iifestrip.js
Created Sep 15, 2016
Strip IIFEs from files in a directory. You'll need minimist and recursive-readdir. Doesn't work on IIFEs that have args passed in
View iifestrip.js
var fs = require('fs');
var path = require('path');
var recursive = require('recursive-readdir');
var argv = require('minimist')(process.argv.slice(2));
var iifepath = path.resolve(process.cwd(), argv.path);
function isIIFEStart (string) {
// whatever you don't know my life
return string === '(function () {' ||
@wayspurrchen
wayspurrchen / npm-f3-install.sh
Created Sep 2, 2016 — forked from SuperPaintman/npm-f3-install.sh
NPM install for low RAM machins. And "npm install ... killed" problem
View npm-f3-install.sh
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
View gist:3b86cff84cdafca6e9e6
var categories = [
{
id: 0,
name: 'Shoes',
imageUrl: 'alkfaekfja0-43i'
},
{
id: 1,
name: 'Clothing',
imageUrl: 'someshit'
@wayspurrchen
wayspurrchen / server.js
Created Oct 22, 2014
Thin Node.js proxy server for front-end-only SPAs that need to make CORS requests
View server.js
// Node.js proxy server for CORS requests with single page, no-backend apps.
//
// Instructions:
// 1) Place file into your app directory
// 2a) If you don't have a package.json file in this directory, run "npm init" first
// 2b) Run "npm install --save express request query-string"
// 3) Run server with "node server.js"
// 4) Configure Express to use whatever folder you want to serve your site out of.
// By default, this will run out of whatever folder you have your server.js in,
// but you shouldn't do this since it'll make everything in this folder accessible,
@wayspurrchen
wayspurrchen / injector.js
Last active Jan 9, 2016
demo code showing how AngularJS 1.6 injectors (probably) magically inject services by name
View injector.js
/**
* This gist shows how you can inject other functions/variables
* into a function only by name. I imagine this is probably something
* like how AngularJS 1.6 does it, but Angular relies on an internal
* list of registered modules instead of just whatever's floating
* around the namespace, which is dangerous.
**/
// Things to inject
function LoggerOne () {