Skip to content

Instantly share code, notes, and snippets.

sagivo / gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
Last active Sep 23, 2020
webRTC stun / turn server list
View gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
to check if the server works -
gaearon / connect.js
Last active Sep 28, 2020
connect.js explained
View connect.js
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
jnozzi / NSURL+FavoritesList.h
Last active Jul 11, 2016
NSURL category that provides a simple way to append a fileURL to the end of favorite items or favorite volumes list used in the side bars seen in Finder and the open and save dialog boxes.
View NSURL+FavoritesList.h
// NSURL+FavoritesList.h
// FavoritesListTester
// Appends the URL to the end of the Favorite Items or Favorite Volumes list
// (found in the side bar of Finder windows and open/save dialogs, etc.)
// Notes:
// 1. Must be a file URL.
View index.html
<!DOCTYPE html>
<video> controls autoplay width="1920"></video>
<script type="text/javascript">
var buffer;
sebmarkbage / Enhance.js
Last active Sep 6, 2020
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {
jordansexton / count.js
Last active Sep 1, 2018
Bookshelf.js/Knex.js innerJoin withRelated
View count.js
var Promise = require('bluebird'),
User = require('./user'),
knex, query;
knex = User.prototype._builder(User.prototype.tableName);
query = function (q) {
.innerJoin('orders', function () {
this.on('', '=', 'orders.user_id')
kimus /
Created Mar 2, 2014
NAT and FORWARD with Ubuntu’s ufw firewall


I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

steakknife /
Last active Feb 29, 2020
Make a tarball of manpages from Linux for Dash (OSX)
set -ex
TEMP_DIR="$(mktemp -d -t XXXX)"
# cleanup
trap 'RESULT=$?; rm -rf "$TEMP_DIR" ; exit $RESULT' INT TERM EXIT QUIT
cd "$TEMP_DIR"
weotch / main.js
Last active Mar 13, 2016
Backbone routing example using require.js
View main.js
// This our standard require js bootstrap file. It assumes you are using the
// require-jquery.js file that require.js provides
// Set the require.js configuration for the application
// Base path used to load scripts
baseUrl: 'js/',
// Prevent caching during dev
urlArgs: "bust=" + (new Date()).getTime(),
postrational / gunicorn_start.bash
Last active Sep 15, 2020
Example of how to set up Django on Nginx with Gunicorn and supervisord
View gunicorn_start.bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
You can’t perform that action at this time.