Skip to content

Instantly share code, notes, and snippets.

@jaeming
jaeming / index.html
Created September 19, 2014 12:06
Pop-up box with blurred background
<div id="overlay" class="cover blur-in">
<div class="content">
<h1>The history or Lorem Ipsum</h1>
<span>
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
</span>
<span>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse faucibus viverra porta. Pellen
@jaeming
jaeming / Gruntfile.js
Created October 26, 2014 13:43
Gruntfile for simple haml to html
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-haml');
grunt.initConfig({
uglify: {
my_target: {
files: {
'js/script.js': ['javascripts/*.js']
@jaeming
jaeming / gist:03ba5469a11026374f57
Last active August 29, 2015 14:17
Learning Rails

Getting a taste for Ruby:

Try Ruby

Get a taste of Rails by creating a simple blog:

Getting Started

A little bit more with some Zombie fun:

@jaeming
jaeming / 1_fizzbuzz_with_if_else.rb
Last active August 29, 2015 14:21
Exploring FizzBuzz
def fizzbuzz
(1..100).each do |n|
if (n % 3 == 0) && (n % 5 == 0)
puts 'FizzBuzz'
elsif n % 3 == 0
puts 'Fizz'
elsif n % 5 == 0
puts 'Buzz'
else
puts n
@jaeming
jaeming / index.html
Created September 21, 2015 16:40
Opal screencast 101 - code#1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Opal Experiments</title>
<link rel="stylesheet" href="main.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/opal/0.3.43/opal.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/opal-parser/0.3.43/opal-parser.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/opal-jquery/0.0.8/opal-jquery.min.js"></script>
@jaeming
jaeming / index.html
Created September 21, 2015 16:42
opal 101 ajax
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Opal Experiments</title>
<link rel="stylesheet" href="main.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/opal/0.3.43/opal.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/opal-parser/0.3.43/opal-parser.min.js"></script>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/opal-jquery/0.0.8/opal-jquery.min.js"></script>
@jaeming
jaeming / plugboard.rb
Created October 28, 2015 13:12
Enigma machine
class Plugboard
def initialize(wires = '')
@wires = wires
validate unless @wires.empty?
end
def validate
return raise "wire error" unless @wires.is_a?(String)
return raise "wire error" if @wires.chars.uniq!
def list names
name_list = names.map(&:values).flatten
if name_list.length > 1
with_ampersand = " & #{name_list.pop}"
solution = name_list.join(', ') << with_ampersand
else
solution = name_list.join
end
end
class Abbreviator
def self.abbreviate(s)
s.split(/\b/).map{|w|w.size>3?"#{w[0]}#{w.size-2}#{w[-1]}":w}.join
end
end
def valid?(pattern)
pattern.map(&:uniq!).map(&:nil?).include?(false) ? false : true
end
def validSolution(board)
rows, columns, grids = board, [], []
9.times do |i|
column, grid = [], []
board.map { |row| column << row[i] }