This file contains hidden or 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 ReportFormatter | |
class << self | |
def ascii(data) | |
new.ascii(data) | |
end | |
end | |
# {first_table: [{title: "contents"}], second_table: []} | |
def ascii(data) | |
data.map do |k, v| |
This file contains hidden or 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
for user in users | |
try | |
create_user(user) | |
catch Sequel::Error => e | |
#log error | |
next | |
end | |
end | |
## |
This file contains hidden or 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 class="flash-messages"> | |
<% %i(error notice success).each do |type| %> | |
<% if flash[type] %> | |
<div class="flash-message-<%= type %>"> <%= flash[type] %> </div> | |
<% end %> | |
<% end %> | |
</div> |
This file contains hidden or 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 'set' | |
module Validateable | |
attr_reader :validation_strategies | |
def self.included(receiver) | |
receiver.instance_variable_set(:@validation_strategies, Set.new) | |
receiver.extend ClassMethods | |
receiver.send :include, InstanceMethods | |
end | |
This file contains hidden or 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
// $npm install --save-dev ember-cli-content-security-policy | |
//config/environment.js | |
module.exports = function(environment) { | |
var ENV = { | |
contentSecurityPolicy: { | |
'script-src': "'self' 'unsafe-eval'", | |
'style-src': "'self' 'unsafe-inline'" | |
} | |
}; |
This file contains hidden or 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
main :: Int -> Int -> IO | |
main x y = putStrLn (show (x+y)) | |
-- Compilation error main.hs:2:23: Expecting one more argument to `IO' In the type signature for `main': main :: Int -> Int -> IO |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
var entities = { | |
address: 1, | |
block: 2, | |
transaction: 3, | |
}; | |
entities.humanize = function (id) { | |
switch (id) { | |
case 1: | |
return 'address'; | |
case 2: |
This file contains hidden or 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
{- | |
Prelude> :t [['a','b','c'],['d','e']] | |
[['a','b','c'],['d','e']] :: [[Char]] | |
Prelude> head [['a','b','c'],['d','e']] | |
"abc" | |
Prelude> head (head [['a','b','c'],['d','e']]) | |
'a' | |
Prelude> head [[]] | |
[] | |
1. Rewrite the previous list literals using only (:) and the empty list constructor []. |