JSConf.eu opening song - JavaScript Will Listen - Bella Morningstar
- Plask - Dean McNamee
- Plask
| class Person < ActiveRecord::Base | |
| before_save :cleanup | |
| def name | |
| "#{first_name} #{last_name}" | |
| end | |
| private |
| #!/usr/bin/env ruby | |
| require "mail" | |
| require "optparse" | |
| imap_opts = { | |
| :address => "imap.gmail.com", | |
| :port => 993, | |
| :enable_ssl => true | |
| } |
| alessio@alessio-Extensa-5510:~ | |
| → rvm install jruby | |
| jruby-1.6.3 - #fetching | |
| jruby-1.6.3 - #extracted to /home/alessio/.rvm/src/jruby-1.6.3 (already extracted) | |
| Building Nailgun | |
| jruby-1.6.3 - #installing to /home/alessio/.rvm/rubies/jruby-1.6.3 | |
| jruby-1.6.3 - #importing default gemsets (/home/alessio/.rvm/gemsets/) | |
| Copying across included gems | |
| Building native extensions. This could take a while... | |
| ERROR: Error installing jruby-launcher: |
| var app = require('../app'); | |
| console.log(); | |
| app.routes.all().forEach(function(route){ | |
| console.log(' \033[90m%s \033[36m%s\033[0m', route.method.toUpperCase(), route.path); | |
| }); | |
| console.log(); | |
| process.exit(); |
| app.get('/lect1.html', function (req, res) { | |
| var a_local_variable; | |
| // you do some stuff here | |
| if (some_condition) { | |
| a_local_variable = value; | |
| } | |
| res.render('lect1', { | |
| // this has a dynamic value | |
| 'my_var': a_local_variable | |
| }); |
| # Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference. | |
| # The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2 | |
| # Step 0: Check what is going on at port 80 | |
| $ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c | |
| # Step 1: Increase the number of available fds | |
| $ ulimit -n 32000 | |
| # Step 2: Restart your webserver, for me: |
| UserSchema.post('save', function() { | |
| this.emit('changed', this, this.altered); | |
| delete this.altered; | |
| }); |
| function get_real_ip() | |
| { | |
| if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet | |
| { | |
| $ip=$_SERVER['HTTP_CLIENT_IP']; | |
| } | |
| elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy | |
| { | |
| $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; | |
| } |
| var express = require("express"), | |
| csrf = require('express-csrf'), | |
| form = require('connect-form'), | |
| connectTimeout = require('connect-timeout'), | |
| RedisStore = require('connect-redis')(express), | |
| SessionStore = new RedisStore(), | |
| mongoose = require("mongoose"), | |
| winston = require('winston'), | |
| configs = require("./configs"), | |
| port = process.argv[2] || 80, |