Skip to content

Instantly share code, notes, and snippets.

View bmelton's full-sized avatar
💭
I may be slow to respond.

Barry Melton bmelton

💭
I may be slow to respond.
View GitHub Profile
@bmelton
bmelton / derrick_01
Last active December 20, 2015 06:59
How to swap a div or something like that.
Your HTML should look something like this.
<div id="container">
<div id="target_div">
<div class="target" id="target_01"><h2>Research Driven</h2><p>Blah blah blah.</p></div>
<div class="target" id="target_02"><h2>Some other content</h2><p>And stuff like that.</p></h2></div>
<div class="target" id="target_03"><h2>Some other content</h2><p>And stuff like that.</p></h2></div>
<div class="target" id="target_04"><h2>Some other content</h2><p>And stuff like that.</p></h2></div>
</div>
<div id="buttons">
@bmelton
bmelton / gist:7947930
Last active December 31, 2015 06:29
Modal HTML Content
<style type="text/css">
.dialogOpen #wrap {
opacity: .5; background-color: black; position: fixed; top: 0; right: 0; bottom: 0; left: 0;
}
#wrap {opacity: 0;}
#modal {
font: 14px Arial, sans-serif; -webkit-box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5); z-index: 999;
color: black; background: white; position: fixed; width: 8 0%; top: 30%; left: 50%;
margin: -25% 0 0 -45%;transform: scale(1.5);opacity: 0; pointer-events: none; padding: 0px 20px 20px 20px;
min-height: 80px; -webkit-border-radius: 5 px;
# Model looks like this:
class Status(models.Model):
user = models.ForeignKey(User)
uuid = models.CharField(max_length=22, null=True, blank=True)
created = models.DateTimeField(null=True, blank=True)
content = models.TextField()
def save(self, *args, **kwargs):
if not self.uuid:
self.uuid = uuid()
<?php
if($HTTP["request-method"] == "POST") {
//error_reporting(E_ALL ^ E_NOTICE); // hide all basic notices from PHP
//If the form is submitted
if(isset($_POST['submitted'])) {
// require a name from user
if(trim($_POST['contactName']) === '') {
$nameError = 'Forgot your name!';
<?php
//error_reporting(E_ALL ^ E_NOTICE); // hide all basic notices from PHP
$response = array(
"errors" => false,
"success" => true,
"messages" => "",
);
if($_SERVER["REQUEST_METHOD"] == "POST") {
angular.module('FixDateFilter', [])
.filter('fixdate', function() {
return function(input) {
if(input == null)
output = "N/A";
else if(input == "midnight")
output = "N/A";
else if(input == "")
output = "N/A";
else if(input == "1900-01-01")
#!/usr/bin/env bash
# Update Apt
apt-get update
# Install necessary things
apt-get install software-properties-common python-software-properties python g++
apt-get install -y make
apt-get install -y nginx
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "astral1/saucy64"
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.network :forwarded_port, host: 4567, guest: 80
config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".git/"
config.vm.provider "virtualbox" do |vb|
end
class StatusViewSet(viewsets.ModelViewSet):
def pre_save(self, obj):
obj.user = self.request.user
def post_save(self, obj, created):
if created:
parse_links(obj)
if obj.send == True:
send_tweet(obj)
pass
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
js: {
src: [
'static/js/lib/jquery-1.10.2.min.js',
'static/js/lib/angular.min.js',
'static/js/lib/angular-animate.min.js',
'static/js/angular-linkify.min.js',