Skip to content

Instantly share code, notes, and snippets.

View nicooga's full-sized avatar

Nicolas Oga nicooga

View GitHub Profile
@nicooga
nicooga / mail_form.coffee
Last active August 29, 2015 14:10
Contact Mail Form - HTML and JS using Mandrill API
class window.Mail
constructor: (@attrs)->
from_email: -> @attrs['from_email']
to_email: -> @attrs['to_email']
subject: -> @attrs['subject']
body: -> @attrs['body'] || @attrs_dll()
is_valid: -> @from_email()? && @to_email()? && @subject()? && @body()?
@nicooga
nicooga / game_of_life.rb
Last active October 14, 2021 11:04
Ruby gosu implementation of Cpnway's game of life
require 'gosu'
ANIMATION_INTERVAL = 0.4
module GameOfLife
class Cell
attr_accessor :x, :y
def initialize(hash)
raise 'Bad attribute keys' unless (hash.keys - [:x, :y, :alive]).empty?
Professor.available_at_or_around_or_partially start_time: Time.now, end_time: Time.now.+(2.hours)
SELECT "professors".*
INNER JOIN "professor_availability_periods"
ON "professor_availability_periods"."professor_id" = "professors"."id"
WHERE
(
(
/* available_at */
("professor_availability_periods"."starts_at_sfsow" <= 446340)
require "awesome_print"
module LinkedList
class Node < Struct.new(:head, :tail)
undef :head=
undef :tail=
end
def self.unshift(list, el)
Node.new(el, list)
@nicooga
nicooga / README.md
Last active August 13, 2016 22:35
An script for installing latest version of php via phpenv and phpbuild.

Usage

An script for installing latest version of php via phpenv and phpbuild.

curl https://gist.githubusercontent.com/nicooga/0412767048fbdb4953fd76f88bce7825/raw/install_php.sh | bash

Frontend Footnotes

Contents:

  • Installing NodeJS
  • Installing Ruby
  • Frontend Stuff
  • Javascript Overview
  • What the **** is angular and why everybody is going bananas about it

Installing NodeJS

module Search
def run(query, params)
filters.inject(query) do |memo, filter|
filter.call(memo, params)
end
end
def filter(arg, options = {})
case arg
when Symbol
defmodule Flattening do
def flatten([]), do: []
def flatten([head | tail]) when is_list(head), do: flatten(head) ++ flatten(tail)
def flatten([head | tail]), do: [head | flatten(tail)]
end
IO.inspect Flattening.flatten([[1,2,[3]],[4]])
IO.inspect Flattening.flatten([[1,2,[3]],[4], [5]])
IO.inspect Flattening.flatten([[1,2,[3]],[4], [5, [[6]]]])
IO.inspect Flattening.flatten([[1,2,[3]],[4], [5, [[6]]], [7]])
@nicooga
nicooga / base_factory.rb
Last active September 4, 2018 21:31
Factory for creating talents for testing in screening wizard.
module BaseFactory
extend ActiveSupport::Concern
include ActiveData::Model
included do
delegate :pipe, to: :new
end
class_methods do
def defop(name, &block)
@nicooga
nicooga / README.md
Last active January 3, 2019 16:11
Factory for creating talents for testing in screening wizard based on Eugene Mironov's code

Talent factory meant to speed up manual testing process, based on Eugene Mironov's code.

Just throw files in /lib and use in console.

Factory methods can be chained and used both from class or instances.

TalentFactory.new(vertical: :desginer).create_user.pass_application_submission.claim_english # ...
TalentFactory.create_developer_on_english_step