Skip to content

Instantly share code, notes, and snippets.

View wonjun27's full-sized avatar
🎯
Focusing

Won Jun Bae wonjun27

🎯
Focusing
View GitHub Profile
// Copyright 2014 A Medium Corporation
//
// z-index.less
// Medium.com's z-index scale. Z-index values should always be defined in z-index.less. This
// allows us to at a glance determine relative layers of our application and prevents bugs
// arrising from arbitrary z-index values. Do not edit the z-index scale! Only add application
// scoped z-index values.
// Z-Index Scale (private vars)

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

// jshint node:true
'use strict';
var semver = require('semver'),
exec = require('exec');
module.exports = function(grunt) {
'use strict';
require('load-grunt-tasks')(grunt);
@wonjun27
wonjun27 / copy_db.sql
Last active August 29, 2015 14:07 — forked from swrobel/copy_db.sql
DELIMITER $$
DROP PROCEDURE IF EXISTS `CopyDB` $$
CREATE PROCEDURE `CopyDB` (sourceDB VARCHAR(64),targetDB VARCHAR(64))
TheStoredProcedure:BEGIN
DECLARE found_count,ndx,ndx_last INT;
DECLARE sqlcmd VARCHAR(1024);
SELECT COUNT(1) INTO found_count
FROM information_schema.tables
@wonjun27
wonjun27 / README.md
Last active August 29, 2015 14:07 — forked from oodavid/README.md

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@wonjun27
wonjun27 / README.md
Last active August 29, 2015 14:07 — forked from oodavid/README.md

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

#!/home/ec2-user/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
require 'rubygems'
require 'aws/s3'
require 'fileutils'
AWS::S3::Base.establish_connection!(
:access_key_id => 'access_key',
:secret_access_key => 'secret_key'
)
Capistrano::Configuration.instance(:must_exist).load do
# example execution 'cap bundle_app -s version=HEAD'
desc "Bundle code and push to S3"
task :bundle_app do
puts "Starting Git archive of #{version}"
`git archive -o oldweather.tar #{version}`
`gzip oldweather.tar`
s3_upload
clean_up
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();