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
# a = [[1,2,[3]],4] | |
# aux = [] | |
def flatten(a, aux) | |
a.each do |n| | |
if n.instance_of?(Fixnum) | |
aux<<n | |
elsif n.instance_of?(Array) | |
flatten(n, aux) | |
end | |
end |
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
<?php | |
namespace Tests\Traits; | |
trait ApiTestTrait | |
{ | |
public function assertApiResponse(Array $actualData) | |
{ | |
$this->assertApiSuccess(); |
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
{ | |
"Version":"2012-10-17", | |
"Statement":[ | |
{ | |
"Sid":"AddPerm", | |
"Effect":"Allow", | |
"Principal": "*", | |
"Action":["s3:GetObject"], | |
"Resource":["arn:aws:s3:::examplebucket/*"] | |
} |
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
version: 2 | |
jobs: | |
build: | |
working_directory: /tmp/vasko | |
docker: | |
- image: circleci/python:3.6.2-stretch-browsers | |
steps: | |
- checkout | |
- run: | |
name: Deploying Vasko. |
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 MarkdownConverter | |
attr_reader :markdown | |
private :markdown | |
def initialize(markdown) | |
@markdown = markdown | |
end | |
def as_html | |
converted_markdown.html_safe |
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 'octokit' | |
require 'base64' | |
module GithubStaticPagesJob | |
extend self | |
FILE_NAME_REGEX = /\w+[^\.md]/ | |
def client | |
credentials = { |
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
def show | |
return false if redirect_email_blunder | |
@page = StaticPage.friendly.find(get_page_id(params[:id])) | |
@ancestry = @page.self_and_ancestors.map(&:title).reverse | |
end |
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
<div id="static_page_body"><%= clean_html(@page.body) %></div> |
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
namespace :fetch_github do | |
desc 'Get github content for static pages' | |
task :content_for_static_pages => :environment do | |
GithubStaticPagesJob.run | |
end | |
end |
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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'methadone' | |
require 'primes_table.rb' | |
class App | |
include Methadone::Main | |
include Methadone::CLILogging |
OlderNewer