Skip to content

Instantly share code, notes, and snippets.

@johnsonch
johnsonch / info.php
Created October 6, 2012 14:26
php info
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>

diskutil list

diskutil eraseDisk JHFS+ Emptied /dev/disk2

hdiutil convert -format UDRW -o ~/Downloads/linuxmint-19-xfce-64bit-v2 ~/Downloads/linuxmint-19-xfce-64bit-v2.iso

diskutil unmountDisk /dev/disk2

sudo dd if=/Users/cj/Downloads/linuxmint-19-xfce-64bit-v2.dmg of=/dev/rdisk2 bs=1m

@johnsonch
johnsonch / fizzbuzz_refactor.rb
Created May 24, 2013 18:19
This gist is some not very good ruby code. Refactor it and make it better while keeping the tests pass.
class FizzBuzz
def self.evaluate(number)
if number % 5 == 0 && number % 3 == 0
return "fizzbuzz"
elsif number % 3 == 0
return "fizz"
elsif number % 5 == 0
return "buzz"
else
return number.to_s
#!/usr/bin/env ruby
# In order to make this script run stand alone it needs to run in the context of the gem set that has 'fog' installed.
# However to run as an included file in a spec file it will already need to be in that gemset
if $0 == __FILE__
require 'rvm'
File.open(File.join(File.dirname(__FILE__), '..', '.rvmrc')) do |f|
@rvmrc_gemset = f.read.match(/(ruby[^ ]+)/)[1]
@johnsonch
johnsonch / rvmissue.sh
Created February 1, 2013 17:48
rvmsudo issue
cd ~/
echo pwd
export rvmsudo_secure_path=1
echo "export ok"
rvmsudo ruby-1.9.3-p286@mygemset -e "require 'ghost'; Ghost.store = Ghost::Store::HostsFileStore.new; host = Ghost::Host.new('myvagrant.com', '33.33.33.27'); Ghost.store.add(host)"
echo "rvmsudo ok"
cd /home
echo "change directory"
echo pwd
@johnsonch
johnsonch / gist:4692398
Created February 1, 2013 16:32
Error warning from rvmsudo
Running:
$ rvmsudo ruby-1.9.3-p286@mygemset -e "require 'ghost'; Ghost.store = Ghost::Store::HostsFileStore.new; host = Ghost::Host.new('myvagrant.com', '33.33.33.27'); Ghost.store.add(host)"
Results in:
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. export rvmsudo_secure_path=1 to avoid the warning.Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. export rvmsudo_secure_path=1 to avoid the warning
@johnsonch
johnsonch / index.php
Last active November 1, 2015 02:04
php fall 2015 lab 9 start index.php
<?php
require_once('madlibs.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
@johnsonch
johnsonch / blogpost.css
Created November 1, 2015 02:03
php fall 2015 lab 9 css
/*!
* Start Bootstrap - Blog Post HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
body {
padding-top: 70px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
}
@johnsonch
johnsonch / hack.sh
Created April 20, 2012 19:32 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@johnsonch
johnsonch / Gemfile
Last active October 1, 2015 18:47
2015 MATC Fall Ruby on Rails Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'