Skip to content

Instantly share code, notes, and snippets.

View sheenobu's full-sized avatar
🙃
smug

Sheena Artrip sheenobu

🙃
smug
View GitHub Profile
[5, ["1 x 5"]]
[7, ["1 x 7", "5 x 1 + 1 x 2"]]
[10, ["1 x 10", "2 x 5"]]
[13, ["1 x 13", "5 x 2 + 1 x 3", "10 x 1 + 1 x 3"]]
[15, ["1 x 15", "3 x 5", "10 x 1 + 1 x 5"]]
[18, ["1 x 18", "5 x 3 + 1 x 3", "10 x 1 + 1 x 8"]]
[20, ["1 x 20", "4 x 5", "10 x 2"]]
[25, ["1 x 25", "5 x 5", "10 x 2 + 1 x 5"]]
licenses = [ 20,5,5,1,1,10,1,10,1,1,1,1,1,1,1].sort.reverse
# simulates a sorted SQL select operation on the license table.
def licenses.pop_eq_to_or_less_than(i)
idx = 0
to_slice = -1
for x in self
if x <= i
to_slice = idx
break
@sheenobu
sheenobu / Console.scala
Created December 31, 2012 02:08
Akka/Scala Simple console Actor using scala-lang jline and a recursive actor.
import akka.actor._
import scala.tools.jline._
import scala.tools.jline.console._
import scala.tools.jline.console.completer._
class Console(actor:ActorRef) extends Actor {
val consoleReader = new ConsoleReader()
consoleReader.addCompleter(new StringsCompleter("quit")) // tab completion
@sheenobu
sheenobu / ideas.md
Created January 8, 2013 16:19
Project ideas

Ideas

postman-jsondb

Modify postman to use a versioned JSON database as a backend. We can then share our postman configs by simply pushing to 'username.postman' database and grab new postman configurations by implementing a JSON database search.

@sheenobu
sheenobu / gist:4513963
Created January 11, 2013 21:07
PS1 and aliases
PS1_PATH="\[\e[0;32m\]\W\[\e[0m\]"
PS1_USER="\[\e[0;34m\]\u\[\e[0m\]"
PS1_PROMPT="\[\033[1;33m\]->\[\033[0m\]"
PS1="$PS1_PATH $PS1_USER $PS1_PROMPT "
# aliases
alias ls='gls -X -G -F -t --color=auto --group-directories-first'
@sheenobu
sheenobu / vagrant.hd.rb
Created January 13, 2013 19:17
Vagrant hard drive function.
Vagrant::Config::Top.class_eval do
def hd(name,size,port)
self.vm.customize [ "createhd", "--filename","#{name}.vmdk", "--size", size.to_s, "--format", "vmdk" ]
self.vm.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", port.to_s, "--device", "0", "--type", "hdd", "--medium", "#{name}.vmdk"]
end
end
@sheenobu
sheenobu / gist:4627518
Last active December 11, 2015 16:28
show_tableview_menu
def show_tableview_menu(b)
b.list_view do |x|
x.title = "Example iOS Application"
x.button "SameGame" do |nav|
show_samegame(nav)
end
x.button "Hello World" do |nav|
show_hello(nav)
end
x.button "Global IP" do |nav|
@sheenobu
sheenobu / gist:4627602
Last active December 11, 2015 16:28
show_tableview_menu
def show_tableview_menu(b)
b.list_view do |x|
x.title = "X"
x.button "SameGame" do |nav|
show_samegame(nav)
end
x.button "Hello World" do |nav|
show_hello(nav)
end
x.button "Global IP" do |nav|
@sheenobu
sheenobu / model.coffee
Last active December 14, 2015 15:38
Dynamic and chainable read only models in coffee-script.
extend = (object, properties) ->
for key, val of properties
object[key] = val
object
merge = (options, overrides) ->
extend (extend {}, options), overrides
class Model
field: (name) ->
module.exports = function(grunt) {
grunt.initConfig({
pkg: {
name: 'test',
version: '0.0.1'
}});
var generateFile = function() {
var tmpl = grunt.file.read("template");
console.log(grunt.template.process(tmpl, { data: { taskName: grunt.task.current.name } } ))