Skip to content

Instantly share code, notes, and snippets.

View cibernox's full-sized avatar
🏠
Working from home

Miguel Camba cibernox

🏠
Working from home
View GitHub Profile
@cibernox
cibernox / gist:6549652
Created September 13, 2013 11:47
Show surrounding lines arround the grep matches
tail -f log/pre_production.log | grep -B 1 -A 5 user
@cibernox
cibernox / filterPropertyBetween.js
Last active August 29, 2015 13:58
First approach to a filterPropertyBetween CP
(function(exports){
exports.computed = {};
/**
* Returns an arrayComputed property that filters the elements in the `dependentKey`
* that have its `propertyKey` between (inclusive) the values in `startKey` and `endKey`.
* It reacts to additions to changes in the `dependentKey`, `startKey` and `endKey`.
*
* Right now it assumes that the array in the dependentKey is sorted and preserves
* that sorting.
@cibernox
cibernox / gist:10308442
Last active August 29, 2015 13:58
filterPropertyBetween
(function(app) {
var computed = {};
/**
* Returns an arrayComputed property that filters the elements in the `dependentKey`
* that have its `propertyKey` between (inclusive) the values in `startKey` and `endKey`.
* It reacts to additions to changes in the `dependentKey`, `startKey` and `endKey`.
*
* Right now it assumes that the array in the dependentKey is sorted and preserves
* that sorting.
completed? && matches.played.count == 132 && matches.non_played.count == 0
serverMiddleware: function(config) {
var app = config.app;
app.use('/docs', function(request, response, next) {
response.send("Hello world");
});
}
serverMiddleware: function(config) {
var app = config.app;
console.log('registring middleware...');
app.use('/docs', function(request, response, next) {
console.log('docs middleware invoked');
response.send("Hello world");
});
}
@cibernox
cibernox / sample.json
Created January 15, 2015 13:56
sample jsonapi
{
"brand": {
"id": "1",
"name": "Audi",
"foundation": "1912",
"models": {
"href": "http://example.com/models/5,12,17,20",
"ids": [ "5", "12", "17", "20" ],
"type": "models"
}
@cibernox
cibernox / Benchmark_results
Last active August 29, 2015 14:15
Benchmarking some frameworks
#
# Run in a Macbook Retine 15" (i7-2GHz + 8GB ram)
#
# Sinatra with ruby 2.2.0 warmed (3rd run)
$ wrk -t4 -c100 -d30S --timeout 2000 "http://127.0.0.1:9292/showdown"
Running 30s test @ http://127.0.0.1:9292/showdown
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
@cibernox
cibernox / custom-authenticator.js
Created June 30, 2015 23:37
custom-autenticator.js
import Ember from 'ember';
import OAuth2Authenticator from 'simple-auth-oauth2/authenticators/oauth2';
// This class inherits from the OAUTH authenticator and customizes the `authenticate` method
// to send the PIN instead of the username/password.
export default OAuth2Authenticator.extend({
authenticate: function(options) {
var _this = this;
return new Ember.RSVP.Promise(function(resolve, reject) {
@cibernox
cibernox / us.svg
Created August 12, 2015 23:50
US flag in svg very optimized.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.