Skip to content

Instantly share code, notes, and snippets.

View nicolaracco's full-sized avatar

Nicola Racco nicolaracco

  • Calco, LC - Italy
View GitHub Profile
#![warn(clippy::all, clippy::pedantic)]
use bracket_lib::prelude::*;
const SCREEN_WIDTH: i32 = 80;
const SCREEN_HEIGHT: i32 = 50;
const FRAME_DURATION: f32 = 75.0;
const DRAGON_FRAMES: [u16; 6] = [64, 1, 2, 3, 2, 1];
struct Obstacle {
x: i32,
@nicolaracco
nicolaracco / datepicker-html5-glue.js
Created January 31, 2014 10:11
Glue to allow you to work with date inputs using the native datepicker when supported and JQuery UI as a fallback
(function() {
var setupDatePickerGlue = function($el, format) {
var elName = $el.attr("name"), // field name
elId = $el.attr("id"), // field id
elValue = $el.attr("value"); // field raw value
// remove the name to prevent value conflict on submit
$el.removeAttr("name");
// prepend an hidden input field with the same name
$el.before($("<input type='hidden' name='" + elName + "' id='raw-" + elId + "' />"));
# Original code: https://github.com/baxter/csterrain/blob/master/src/generate_terrain.coffee
#
#
# Generate realistic looking terrain using the [diamond square algorithm](http://en.wikipedia.org/wiki/Diamond-square_algorithm).
#
#### Generating a height map
# The height map is basically an array of numbers, each element represents
# a point on a map and each number represents the height of that grid.
class @HeightMap
@nicolaracco
nicolaracco / app.ts
Last active December 14, 2020 15:43
Lambda error reporting via CDK
#!/usr/bin/env node
import 'source-map-support/register'
import * as cdk from '@aws-cdk/core'
import { MyLambdaStack } from '../lib/my-lambda-stack'
import { ErrorReportingStack } from '../lib/error-reporting-stack'
const app = new cdk.App()
const errorReportingStack = new ErrorReportingStack(app, 'ErrorReportingStack', {
appName: 'my-app',
@nicolaracco
nicolaracco / app-stack.ts
Created November 6, 2020 11:41
Use lambda@edge in cdk
import * as cdk from '@aws-cdk/core';
import * as s3 from '@aws-cdk/aws-s3';
import * as lambda from '@aws-cdk/aws-lambda';
export interface AppStackProps extends cdk.StackProps {
lambdaParamName: string;
}
export class AppStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props: AppStackProps) {
# app.coffee
require 'express'
class Server
constructor: ->
@app = express()
@server = http.createServer(@app)
@io = SocketIO.listen @server, logger: @logger
@configure_app()
# app.coffee
require 'express'
class Server
constructor: ->
@app = express()
@server = http.createServer(@app)
@io = SocketIO.listen @server, logger: @logger
@configure_app()
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :domain, 'server.ovofarm.com'
set :user, 'user'
set :forward_agent, true
set :deploy_to, '/var/apps/studioinnovo'
set :repository, 'ssh://git@bitbucket.org/gawaine/studioinnovo.git'
@nicolaracco
nicolaracco / exception.log
Created February 17, 2015 09:04
NoMethodError: undefined method `url_options' for Module
NoMethodError: undefined method `url_options' for #<Module:0x007ffe03407410>
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 271 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 222 in call
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/route_set.rb" line 334 in block (2 levels) in define_url_helper
File "/app/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.0/lib/action_dispatch/routing/routes_proxy.rb" line 31 in new_user_confirmation_path
File "/app/vendor/bundle/ruby/2.2.0/gems/devise-3.4.1/lib/devise/controllers/url_helpers.rb" line 52 in new_confirmation_path
File "/app/app/views/devise/shared/_links.slim", line 11 in _app_views_devise_shared__links_slim__4228686031403603823_70364466969860
File "/app/vendor/bundle/ruby/2.2.0/gems/actionview-4.2.0/lib/action_view/template.rb" line 145 in block in render
File "/app/vendor/bundle/ruby/2.2.0/gems/actives
#using excel
ExcelFile::Sheet.defile :game_of_thrones_episodes do
#dunno @ the moment
end
ExcelFile::Row.define :episode_row do
attribute :name
attribute :index
attribute :description