Skip to content

Instantly share code, notes, and snippets.

@veuncent
veuncent / docker_debugging.md
Last active February 21, 2024 00:58
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this:
@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@gregrickaby
gregrickaby / _golden-ratio.scss
Last active August 28, 2023 14:31
Golden Ratio Typography for Sass
//
// Golden Ratio Typography
// --------------------------------------------------
// Golden Ratio Math
//
// Let's do some math so we can build beautiful typography and vertical rhythm.
// For any magic to happen, set the $ContentWidth variable on _variables.scss
// to match your content box width (normally this is 640px, 740px, etc...).
@jonmaim
jonmaim / qs.js
Created December 8, 2012 10:51
Generate query string for angular.js
/* Converts an object into a key/value par with an optional prefix. Used for converting objects to a query string */
var qs = function(obj, prefix){
var str = [];
for (var p in obj) {
var k = prefix ? prefix + "[" + p + "]" : p,
v = obj[k];
str.push(angular.isObject(v) ? qs(v, k) : (k) + "=" + encodeURIComponent(v));
}
return str.join("&");
}