Skip to content

Instantly share code, notes, and snippets.

View andrit's full-sized avatar

Andrew Ritter andrit

View GitHub Profile
@ghiden
ghiden / bargraph.css
Last active January 13, 2017 00:33
D3.js bar graph example
.chart {
background: #b0e0f8;
margin: 5px;
}
.chart rect {
stroke: white;
fill: steelblue;
}
@bradt
bradt / model-order-meta.php
Last active June 26, 2019 12:08
Managing Custom Tables in WordPress
<?php
class WPAS_Model_Order_Meta extends WPAS_Model {
static $primary_key = 'order_id';
static function set_as_refunded( $order_id ) {
$data = array( 'is_refunded' => 1 );
$where = array( 'order_id' => $order_id );
self::update( $data, $where );
}
@TomDunn
TomDunn / .upload.sh
Created April 26, 2017 07:34
Upload zip to S3 from Bitbucket pipelines
BUCKET="!!!!!!!!YOUR_AMAZON_S3_BUCKET_NAME_HERE!!!!!!!!!!"
CONTENT_TYPE="application/zip"
DATE=`date -R`
IN_FILE="revision.zip"
KEY="demo/revision.zip"
RESOURCE="/${BUCKET}/${KEY}"
HMAC="PUT\n\n${CONTENT_TYPE}\n${DATE}\n${RESOURCE}"
zip -r --exclude=*.git* "$IN_FILE" .
@stagas
stagas / how-to-run-apache-and-node.js-together-the-right-way.markdown
Created December 24, 2010 14:45
How to run Apache and Node.js together (the right way)

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3

@BigglesZX
BigglesZX / jQuery.Adjacent.Wrapping.htm
Created December 19, 2010 17:17
Wrap two adjacent elements in a containing div using jQuery
This is a useful trick if you want to wrap two sibling elements in a containing element, for example to fix stupid float bugs in IE7. I had a bit of a time figuring out how to select the right elements (wrapping is easy enough with one element, or one element's children), so I thought I'd share for the Greater Good.
From markup like this:
<div class='form-container'>
...
<div class='form-label'>Name (required)</div>
<div class='form-field'><input type="text" name="you-name" value="" class="textbox" size="30" maxlength="200" /></div>
<div class='form-label'>Email (required)</div>
@martinsik
martinsik / circle_detection.py
Last active April 22, 2023 09:50
Circle detection with OpenCV 3.0
import cv2
import time
import math
import numpy as np
capture = cv2.VideoCapture(0)
print capture.get(cv2.CAP_PROP_FPS)
t = 100
w = 640.0
@jswny
jswny / Flexible Dockerized Phoenix Deployments.md
Last active July 3, 2023 05:25
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@stevekinney
stevekinney / front-end-curriculum.md
Created August 9, 2015 00:47
Front-end Curriculum Draft

Module 1

  • Semantic markup
  • HTML standards mode and quirks mode
  • HTML fundamentals
    • Classes and IDs
  • CSS fundamentals
    • Selectors
    • Resets and normalizers
    • The box model