Skip to content

Instantly share code, notes, and snippets.

View leslie-alldridge's full-sized avatar
😺
Coding with my cat - Looking for React / Python projects to contribute to.

Leslie Alldridge leslie-alldridge

😺
Coding with my cat - Looking for React / Python projects to contribute to.
View GitHub Profile
from django.test import TestCase
# Create your tests here.
from django.urls import reverse
from rest_framework.test import APITestCase, APIClient
from rest_framework.views import status
from .models import Songs
from .serializers import SongsSerializer
# tests for views
handlePageChange = (name) => {
Object.keys(this.state).map(
i => i === name ? this.setState({[name]: true}) : this.setState({[i]: false}))
}
goBack = () => {
Object.keys(this.state).map(
i => this.setState({ [i]: true }))
}
constructor(props) {
super(props);
this.state = { width: 0, height: 0 };
this.updateWindowDimensions = this.updateWindowDimensions.bind(this);
}
componentDidMount() {
this.updateWindowDimensions();
window.addEventListener('resize', this.updateWindowDimensions);
}
["lap", "update", "reset", "toggle", "spacebarListener"].forEach(method => {
this[method] = this[method].bind(this);
});
const localStorage = global.window.localStorage;
export function get(key) {
return localStorage.getItem(key);
}
export function set(key, value) {
if (value === null) {
localStorage.removeItem(key);
} else {
How to remove node_modules
Create a .gitignore file in the git repository if it does not contain one
touch .gitignore 2. Open up the .gitignore and add the following line to the file
node_modules 3. Remove the node_modules folder from the git repository
git rm -r --cached node_modules 4. Commit the git repository without the node modules folder
git commit -m "Removed node_module folder" 5. Push the repository to github
@leslie-alldridge
leslie-alldridge / gmail-auto-archive.js
Created November 12, 2018 23:08 — forked from akamyshanov/gmail-auto-archive.js
GMail Auto Archive script for Google Scripts
function gmailAutoarchive() {
var threads = GmailApp.search("in:inbox label:auto-archive older_than:2d");
Logger.log("found " + threads.length + " threads:");
for(var i = 0; i < threads.length; i++) {
var thread = threads[i];
Logger.log((i+1) + ". " + thread.getFirstMessageSubject());
}
var batch_size = 100;
@leslie-alldridge
leslie-alldridge / docker-help.md
Created November 3, 2018 08:11 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));