Skip to content

Instantly share code, notes, and snippets.

@rijkerd
rijkerd / uploadfirebase.js
Last active August 24, 2021 20:31
Implement of file upload with customrequest using antd and firebase storage
<Upload
name="file"
// eslint-disable-next-line no-undef
customRequest={data => {
const { firebase } = this.props;
const ref = firebase
.storage()
.ref('music')
.child(`${new Date().getTime()}`);
@aerrity
aerrity / react-form-multiple.js
Last active November 20, 2020 10:39
React controlled component (form) with multiple inputs example
import React from 'react';
import ReactDOM from 'react-dom';
class SignUp extends React.Component {
constructor(props) {
super(props);
this.state = {
newsLetter: true,
email: ''
};
@brizandrew
brizandrew / README.md
Created July 28, 2017 22:07
How to use node.js build routines and npm packages in Django.

Using Node.js With Django

When writing django apps it's easy to ignore the organization of your front end code. Often, these backend coders will just write a static js and css file, stick it in the static directory, and call it a day.

You can also build them as two completely independent parts. With a complex gulp build routine independent of the django app. But if you don't know gulp, node, or those kinds of systems it can be a daunting process to get started with.

Enter django-compressor-toolkit (the name doesn't quite roll off the tongue).

Setting Up Django-Compressor-Toolkit

Using django-compressor and django-compressor-toolkit you can write Javascript ES6 code with all its fancy import/export logic or style your pages with sass instead of css, and leave your deploy routine largely untouched.

Git Cheat Sheet

Basic commands

git init Creates a new git repository in the directory

git add <file name> Adds a specific file to staging

git add . or git add -A Adds the full directory and its contents to staging

@ewistrand
ewistrand / wp-custom-paginated-loop.php
Created November 19, 2015 14:49
Custom Wordpress loop with pagination
<?php
/**
* Create post loop query
*/
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'orderby' => 'menu_order',
'order' => 'ASC',
'showposts' => 3,
@DevinWalker
DevinWalker / gist:6fb2783c05b46a2ba251
Created April 17, 2015 17:31
WordPress: Loop through Categories and Display Posts Within
<?php
/*
* Loop through Categories and Display Posts within
*/
$post_type = 'features';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ) :
@kevinwhoffman
kevinwhoffman / loop-custom.php
Last active July 17, 2024 14:47
WordPress - Custom Post Type Loop
<?php
$loop = new WP_Query( array(
'post_type' => 'Property',
'posts_per_page' => -1
)
);
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
@steveathon
steveathon / serverExplode.php
Created August 18, 2014 12:32
Explode PHP $_SERVER['REQUEST_URI'];
<?php
$URIParts = explode('?',$_SERVER['REQUEST_URI']);
$URI = explode('/',$URIParts[0]);
// Shift the array, to move it past the 'root'
@array_shift($URI);
// Now, get rid of any pesky empty end slashes
while ( @count($URI) > 0 && !end($URI) ) {
@array_pop($URI);
}
@doapp-ryanp
doapp-ryanp / gist:4595068
Created January 22, 2013 14:34
configure spotify for linux shortcut keys
#@see rynop.com for details
sudo apt-get install xbindkeys
####now put the following in ~/.xbindkeysrc:
#KeyboardPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
XF86AudioPlay
#KeyboardStop