Skip to content

Instantly share code, notes, and snippets.

View p-jackson's full-sized avatar

Philip Jackson p-jackson

View GitHub Profile
@p-jackson
p-jackson / gist:8079745
Created December 22, 2013 08:24
Closing off a feature branch
git checkout <feature-branch>
git pull
git checkout <release-branch>
git pull
git merge --no-ff <feature-branch>
git push
git tag -a branch-<feature-branch> -m "Merge <feature-branch> into <release-branch>"
git push origin branch-<feature-branch>
git branch -d <feature-branch>
git push origin :<feature-branch>
@p-jackson
p-jackson / reading-settings-into-map.cc
Last active March 9, 2016 21:35
How I might go about reading from a settings file
#include <string>
#include <unordered_map>
using namespace std;
// I've left the types explicit for clarity, but in real code
// I'd probably use `auto`
// The settings object is a hash table of keys and values. Everythings strings,
// no fighting the type system, no 3rd party libraries, everything is C++ 101.
const unordered_map<string, string> userSettings = parseSettings("path/to/settings.ini");
@p-jackson
p-jackson / Cargo.toml
Created July 14, 2016 11:34
Https with hyper on Windows without using OpenSSL
[dependencies]
schannel = "0.0.2"
[dependencies.hyper]
version = "0.7"
default-features = false
@p-jackson
p-jackson / hooks.js
Created April 11, 2019 10:44
What updated in React component
function useTraceUpdate(props) {
const prev = useRef(props);
useEffect(() => {
const changedProps = Object.entries(props).reduce((ps, [k, v]) => {
if (prev.current[k] !== v) {
ps[k] = [prev.current[k], v];
}
return ps;
}, {});
if (Object.keys(changedProps).length > 0) {
@p-jackson
p-jackson / import-flow-back-button.patch
Created July 26, 2019 04:47
Tweaks import url step so it doesn't override existing steps
diff --git a/client/lib/signup/step-actions.js b/client/lib/signup/step-actions.js
index 973d8a89ad..40eb0967ff 100644
--- a/client/lib/signup/step-actions.js
+++ b/client/lib/signup/step-actions.js
@@ -637,15 +637,18 @@ export function isPlanFulfilled( stepName, defaultDependencies, nextProps ) {
}
export function isSiteTypeFulfilled( stepName, defaultDependencies, nextProps ) {
- let siteType, siteTypeValue;
-
diff --git a/client/my-sites/checkout/checkout/secure-payment-form.jsx b/client/my-sites/checkout/checkout/secure-payment-form.jsx
index f30dafbf33..ff83ebadd1 100644
--- a/client/my-sites/checkout/checkout/secure-payment-form.jsx
+++ b/client/my-sites/checkout/checkout/secure-payment-form.jsx
@@ -193,7 +193,7 @@ export class SecurePaymentForm extends Component {
} );
};
- submitTransaction( event ) {
+ async submitTransaction( event ) {
diff --git a/client/my-sites/checkout/checkout/checkout-container.jsx b/client/my-sites/checkout/checkout/checkout-container.jsx
index 3f03dbf5ca..c5a68b0101 100644
--- a/client/my-sites/checkout/checkout/checkout-container.jsx
+++ b/client/my-sites/checkout/checkout/checkout-container.jsx
@@ -35,13 +35,10 @@ function isSiteCreatedDateNew( createdAt, creationWindowInMinutes = 5 ) {
class CheckoutContainer extends React.Component {
state = {
headerText: '',
- shouldDisplaySiteCreatedNotice:
- this.props.isComingFromSignup &&
@p-jackson
p-jackson / export-from-sass-dir.patch
Created January 10, 2020 02:30
Export SASS styles from a public folder by referencing the internal files
diff --git a/client/assets/stylesheets/shared/_typography.scss b/client/assets/stylesheets/shared/_typography.scss
index 4a59103c03..34e69045bb 100644
--- a/client/assets/stylesheets/shared/_typography.scss
+++ b/client/assets/stylesheets/shared/_typography.scss
@@ -1,4 +1,4 @@
-@import '~@automattic/components/src/styles/_typography.scss';
+@import '~@automattic/components/sass/_typography.scss';
// Typeface Variables
@p-jackson
p-jackson / classes-as-action-creators.ts
Created January 20, 2020 09:55
Using classes as action creators
// Action Creators
class IncrementCounter {
readonly type = 'INCREMENT_COUNTER';
}
class SetCounter {
readonly type = 'SET_COUNTER';
constructor( public newValue: number ) {}
}
@p-jackson
p-jackson / testing-block.js
Created February 4, 2020 08:55
Testing block with notice in placeholder
/**
* WordPress dependencies
*/
import { Placeholder, withNotices } from '@wordpress/components';
import { useEffect } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { resizeCornerNE as icon } from '@wordpress/icons';
const Edit = withNotices( ( { noticeOperations, noticeUI } ) => {
useEffect( () => {