Skip to content

Instantly share code, notes, and snippets.

View yowchun93's full-sized avatar
🇲🇾
Hello from Malaysia!

YC Yap yowchun93

🇲🇾
Hello from Malaysia!
View GitHub Profile
@sgup
sgup / recommended-routine.md
Last active October 16, 2024 00:14
Recommended Routine - Reddit BodyweightFitness
@robert
robert / game_of_life.py
Last active December 22, 2023 10:40
Programming projects for Advanced Beginners #2: Game of Life
import random
import time
DEAD = 0
LIVE = 1
def dead_state(width, height):
"""Constuct an empty state with all cells set to DEAD.
Parameters
@RobertoSchneiders
RobertoSchneiders / deploy_with_ebcli3_on_circleci.md
Last active October 29, 2024 19:38
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

This is how I configured the deploy of my rails apps to AWS Elastic Beanstalk through CircleCI 1.0.

If you are using the Circle CI 2.0, take a look at this article from ryansimms

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
    The aws user must have the right permissions. This can be hard, maybe, this can help you.
@cfmitrah
cfmitrah / jqueryValidationErrorPlacementSemanticUI.js
Created May 9, 2014 19:24
jQuery validation error placement for Semantic-UI
jQuery(document).ready(function($) {
$.validator.setDefaults({
errorClass: 'errorField',
errorElement: 'div',
errorPlacement: function(error, element) {
error.addClass("ui red pointing above ui label error").appendTo( element.closest('div.field') );
},
highlight: function(element, errorClass, validClass) {
$(element).closest("div.field").addClass("error").removeClass("success");
},
@henrik
henrik / luhn_checksum.rb
Created November 30, 2011 17:02
Luhn checksum/check digit generation in Ruby.
class Luhn
def self.checksum(number)
digits = number.to_s.reverse.scan(/\d/).map { |x| x.to_i }
digits = digits.each_with_index.map { |d, i|
d *= 2 if i.even?
d > 9 ? d - 9 : d
}
sum = digits.inject(0) { |m, x| m + x }
mod = 10 - sum % 10
mod==10 ? 0 : mod