Skip to content

Instantly share code, notes, and snippets.

@lessless
lessless / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
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
// $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'"
}
};
<button {{action 'addEntity' 'vehicle'}}>Add Vehicle </button>
<br>
<form {{action 'save' on='submit'}}>
{{#each model.vehicles}}
<div>
{{input content=kind placehold="Kind"}}
</div>
{{/each}}
<input type='submit'>
</form>
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
<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>
for user in users
try
create_user(user)
catch Sequel::Error => e
#log error
next
end
end
##
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|
define('timezones', [], function(){
return [
{
"value": "Dateline Standard Time",
"abbr": "DST",
"offset": -12,
"isdst": false,
"text": "(UTC-12:00) International Date Line West"
},
{
var pickFiles = require('broccoli-static-compiler');
var foundation = pickFiles('bower_components/foundation/scss/foundation', {
srcDir: '/',
files: ['**/*'],
destDir: '/assets/foundation'
});
var mergeTrees = require('broccoli-merge-trees');
module.exports = mergeTrees([app.toTree(), foundation], {
overwrite: true