Skip to content

Instantly share code, notes, and snippets.

Swizec Teller Swizec

Block or report user

Report or block Swizec

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:100cf58948c84e7454ad9c9dbe9e1d37
15:53:14.409 [INFO ] Copying the repository's data: RepositoryEntry{id=9dd45702-6fa8-11e8-99db-fa163e67f194, projectId=76bade28-2ce8-11e8-bb6e-fa163ee88118, name='non-root-uf', url='https://gecgithub01.walmart.com/ms-tf-logsearch/mls-splunk-uf.git', branch='master', commitId='null', path='null', secretId=28c1842a-67c0-11e8-94f9-fa163e67f194, secretName='mls-uf-pass_1', hasWebHook=true, secretStoreType=null}
15:53:15.719 [INFO ] Storing policy 'concord-system' data
15:53:15.768 [INFO ] Using entry point: default
15:53:16.449 [INFO ] Applying policies...
15:53:19.026 [INFO ] Acquired by: Concord-Agent: id=2fe38959-6d20-56a7-8e49-2bfbbc206741 (10.227.246.95)
15:53:20.609 [INFO ] Process status: RUNNING
Agent ID: 2fe38959-6d20-56a7-8e49-2bfbbc206741
15:53:20.399 [INFO ] Checking the dependency policy
Dependencies:
mvn://com.walmartlabs.concord.plugins.basic:concord-tasks:0.78.1
View quick redux from scratch
function createStore(reducer, preloadedState) {
let state = preloadedState;
let listeners = [];
const subscribe = (callback) => {
listeners = [...listeners, callback];
return function () {
listeners = listeners.filter(f => f !== callback);
}
}
@Swizec
Swizec / cloudSettings
Last active Jun 26, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-06-26T22:06:25.478Z","extensionVersion":"v3.3.1"}
@Swizec
Swizec / HNApi.js
Created Aug 3, 2017
Unofficial HackerNews write API wrapper
View HNApi.js
import cheerio from 'cheerio-without-node-native';
const convertRequestBodyToFormUrlEncoded = (data) => {
const bodyKeys = Object.keys(data);
const str = [];
for (let i = 0; i < bodyKeys.length; i += 1) {
const thisKey = bodyKeys[i];
const thisValue = data[thisKey];
str.push(`${encodeURIComponent(thisKey)}=${encodeURIComponent(thisValue)}`);
View Article copy for @KarlLHuges
# You don't need tests
Unit tests are pointless. Integration tests are hard. Clicky tests are king.
You write a piece of code and you *know* it works. You just wrote it. You just ran it. You just saw it do everything you thought to try. Any unit or integration tests would have confirmed this.
Your PM gets your code and tries it out. They find a bunch of things you forgot. Bits of the spec that you missed, nuances in edge cases you didn't think of, strange things even the PM didn't think of.
The designer finds a bunch of crap that should've been obvious, but you're not a designer so you didn't think it was obvious.
@Swizec
Swizec / .eslintrc
Last active Jun 5, 2018
This is a basic eslintrc designed to annoy you, but not too much.
View .eslintrc
ecmaFeatures:
modules: true
jsx: true
parser:
babel-eslint
env:
amd: true
browser: true
View sample.js
// Contrived example of destructuring objects where local context has different name for keys
// Think of it as "When giving a value, the context has a different name for it than when getting the value"
// LabelX becomes just X when you're a label.
// There are many reasons why this isn't (and maybe shouldn't be) possible
let makeInput = ({x, value}) => (
<DoInputStuff />
)
@Swizec
Swizec / gist:1c45d563c143c666c4a3
Created Nov 30, 2015
React Indie Bundle free sample
View gist:1c45d563c143c666c4a3
Hey,<br />
<br />
Thanks for checking out the React Indie Bundle.<br />
Here are the 4 book chapters and 42min of videos we promised:
<ul>
<li><a href="https://www.youtube.com/watch?v=4MOkIG9sEBU&amp;list=PLF8WgaD4xmjUfL4lo12ugd9ZIheP-sGrB&amp;index=1&amp;utm_source=drip&amp;utm_medium=email&amp;utm_campaign=react-bundle-sample">Build Web Apps with React JS and Flux</a>&nbsp;(3 videos)</li>
<li><a href="http://reactkungfu.com/assets/misc/sample.pdf?utm_source=drip&amp;utm_medium=email&amp;utm_campaign=react-bundle-sample">React.js by example</a> (book chapter)</li>
<li><a href="http://samples.leanpub.com/reactd3js-sample.pdf?utm_source=email&amp;utm_medium=drip&amp;utm_campaign=react-bundle-sample">React+d3.js</a> (book chapter)</li>
<li><a href="https://www.youtube.com/watch?v=dnZbOXvXE4Q&amp;list=PLF8WgaD4xmjUfL4lo12ugd9ZIheP-sGrB&amp;index=5&amp;utm_source=email&amp;utm_medium=drip&amp;utm_campaign=react-bundle-sample">Build Apps with React Native</a> (4&nbsp;videos)</li>
<li><a href="https://dl.dropb
@Swizec
Swizec / assets.rake
Last active Oct 3, 2015
Webpack rails configs
View assets.rake
# lib/tasks/assets.rake
# The webpack task must run before assets:environment task.
# Otherwise Sprockets cannot find the files that webpack produces.
Rake::Task["assets:precompile"]
.clear_prerequisites
.enhance(["assets:compile_environment"])
namespace :assets do
# In this task, set prerequisites for the assets:precompile task
task compile_environment: :webpack do
View gist:b7bf942779e2121b97c9
def upgrade():
op.add_column('control_assessments', sa.Column('control_id', sa.Integer()))
op.create_foreign_key('fk_control_control_assessment', 'control_assessments', 'controls', ['control_id'], ['id'])
def downgrade():
op.drop_column('control_assessments', 'control_id')
op.drop_constraint('fk_control_control_assessment', 'control_assessments', 'controls')
You can’t perform that action at this time.