This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @author Naren Siva Subramani (https://github.com/ufo2mstar) | |
# @abstract .. because it represents, Life!! | |
# @deprecated Because there is always a Better Life out there! | |
## @since 0.0.1 (http://semver.org) | |
# @see https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life | |
# == Conway's Game of Life | |
# Haha.. I've been meaning to implement this for a while now!! | |
# Finally got the chance to :) | |
# Hopefully we play the Game of Life well.. | |
# PS: if only Real Life was this simple.. hmm.. maybe.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logging' | |
# Logger params | |
Logging.init :debug, :info, :warn, :error, :fatal | |
# Custom colour set | |
Logging.color_scheme('my_bright', | |
:levels => { | |
:debug => :blue, | |
:info => :green, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'base64' | |
class EncodeHtml | |
def initialize() | |
end | |
def img64(path) | |
ext = File.extname(path).strip.downcase[1..-1] | |
# enc = Base64.encode64(File.open(path, "rb").read) # gives pretty output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zip' | |
# This is a simple example which uses rubyzip to | |
# recursively generate a zip file from the contents of | |
# a specified directory. The directory itself is not | |
# included in the archive, rather just its contents. | |
# | |
# Usage: | |
# directoryToZip = "/tmp/input" | |
# output_file = "/tmp/out.zip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# server.rb | |
require 'sinatra' | |
require "sinatra/namespace" | |
require 'json' | |
# require 'mongoid' | |
# DB Setup | |
# Mongoid.load! "mongoid.config" | |
# Models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Card = () => { | |
class Parent { | |
mtd(){ | |
return "parent" | |
} | |
} | |
class Mid extends Parent { | |
mtd(){ | |
return super.mtd()+"mid" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
public class ModelTreeNode { | |
final String name; | |
final List<ModelTreeNode> children; | |
private int offset = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BinTree | |
class Node | |
attr_accessor :data, :left, :right | |
def initialize int | |
@data = int | |
end | |
def to_s | |
"Node: #{object_id}: data: #{data}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = `netsh wlan show profile` | |
profile_names = [] | |
str.scan(/^.*Profile\s+: (.*)$/) {|x| profile_names << x[0]} | |
wifi_profiles = {} | |
nil_wifi_profiles = [] | |
profile_names.each do |name| | |
cmd = "netsh wlan show profile name=#{name} key=clear" | |
str = `#{cmd}` | |
pswd = str[/^\s+Key Content\s+: (.*)$/, 1] | |
pswd ? wifi_profiles[name] = pswd : nil_wifi_profiles << name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
OlderNewer