Skip to content

Instantly share code, notes, and snippets.

View benkeen's full-sized avatar

Ben Keen benkeen

View GitHub Profile
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
@philipp-r
philipp-r / download-unzip.php
Last active October 20, 2023 13:32
Download and unzip file with PHP
<?php
// get latest german WordPress file
$ch = curl_init();
$source = "https://de.wordpress.org/latest-de_DE.zip";
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
curl_close ($ch);
@stefanfoulis
stefanfoulis / docker_for_mac_disk_default_size.md
Last active June 29, 2023 12:02
How to resize Docker for Mac Disk image and set the default size for new images

Set the default size for new Docker for Mac disk images

UPDATE: The instructions here are no longer necessary! Resizing the disk image is now possible right from the UI since Docker for Mac Version 17.12.0-ce-mac49 (21995).

If you are getting the error: No space left on device

Configuring the qcow2 size cap is possible in the current versions:

# my disk is currently 64GiB
@DethAriel
DethAriel / typescript.def
Created September 7, 2016 00:43
Basic TypeScript syntax highlighting rules for FishEye/Crucible
# Basic TypeScript syntax highlighting rules for FishEye/Crucible.
#
# Put this file to the <FISHEYE_INST>/syntax directory and update the
# <FISHEYE_INST>/syntax/filename.map file to contain the following lines:
#
# "**/*.ts" typescript.def "TypeScript"
#
# FishEye/Crucible might need to be restarted to have the changes take effect.
#
# References:
@nolanlawson
nolanlawson / why_we_dropped_lerna_from_pouchdb.md
Last active December 13, 2023 10:56
Why we dropped Lerna from PouchDB

Why we dropped Lerna from PouchDB

We dropped Lerna from our monorepo architecture in PouchDB 6.0.0. I got a question about this from @reconbot, so I thought I'd explain our reasoning.

First off, I don't want this post to be read as "Lerna sucks, don't use Lerna." We started out using Lerna, but eventually outgrew it because we wrote our own custom thing. Lerna is still a great idea if you're getting started with monorepos (monorepi?).

Backstory:

@bcherny
bcherny / react-rollup-typescript.md
Last active January 30, 2024 12:13
react + rollup + typescript boilerplate

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx
@cristianossd
cristianossd / drawing-tools.html
Created February 27, 2016 17:18
Using Google Maps drawing tools and getting shape coordinates
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>Drawing Tools</title>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing"></script>
<style type="text/css">
#map, html, body {
@kmaida
kmaida / ng-image-onload.js
Last active November 3, 2017 14:25
AngularJS image onload directive
app.module['myApp'].directive('imageOnload', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('load', function() {
// call the function that was passed
scope.$apply(attrs.imageOnload);
// usage: <img ng-src="src" image-onload="imgLoadedCallback()" />
});
@pedrogpimenta
pedrogpimenta / convert sass to scss
Created April 11, 2014 16:51
Convert SASS to SCSS and delete .sass files (applies to all files in current folder)
sass-convert -R ./ -F sass -T scss && rm *.sass
@wolstena
wolstena / gist:7162707
Created October 25, 2013 22:20
msdeploy example
msdeploy -verb:sync -source:appHostConfig="music_stage_aliases" -dest:="music_aliases",computerName="web5" -enableLink:AppPoolExtension -enableLink:ContentExtension -replace:objectName=site,targetAttributeName=id,replace=20 -replace:objectName=binding,targetAttributeName=bindingInformation,match=10\.1\.11\.,replace=10.1.15. -replace:objectName=binding,targetAttributeName=bindingInformation,match=stage\.web1\.,replace=web5. -replace:objectName=application,scopeAttributeName=applicationPool,match=_stage_,replace=_ -replace:objectName=virtualDirectory,scopeAttributeName=physicalPath,match=_stage_,replace=_ -replace:objectName=filePath,scopeAttributeName=path,match="web.config",replace="web.stage.config" -replace:objectName=filePath,scopeAttributeName=path,match="web.prod.config",replace="web.config" -whatif