Skip to content

Instantly share code, notes, and snippets.

chuckbjones / deploy.rb
Created Aug 22, 2012
Generate static html files at deploy time in Rails 3.x
View deploy.rb
# define a method to run rake tasks
def run_rake(task, options={}, &block)
rake = fetch(:rake, 'rake')
rails_env = fetch(:rails_env, 'production')
command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}"
run(command, options, &block)
#-- Script to automate
# Forked from the original to do the opposite: Switch ssh repo urls to https
# Original here:
# Thanks to @m14t
#origin or upstream
REPO_URL=`git remote -v | grep -m1 "^$REMOTE" | sed -Ene's#.*([^[:space:]]*).*#\1#p'`
View linkchecker input
<a href="">1</a>
<a href="">2</a>
<a href="">3</a>
<a href="">4</a>
<a href="">5</a>
<a href="">6</a>
<a href="">7</a>
<a href="">8</a>
chuckbjones / ppmread.c
Last active Dec 16, 2015
ppmread - display a pgma or ppm file using OpenGL.
View ppmread.c
* Charles Jones
* 2013-04-14
* ppmread - display a pgma or ppm file using OpenGL
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
chuckbjones /
Created Feb 17, 2015
Quadratic Formula in Python
#!/usr/bin/env python
import math
import sys
def quad(a, b, c):
disc = b**2 - 4*a*c
if disc < 0:
return None, None
disc_sqrt = math.sqrt(disc)
res_p = ((-b + disc_sqrt) / (2*a))
* Copyright (C) 2006 The Android Open Source Project
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software