emacs --daemon
to run in the background.
emacsclient.emacs24 <filename/dirname>
to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
- Undo -
C-/
- Redo -
C-?
- Change case: 1. Camel Case :
M-c
2. Upper Case :M-u
- Lower Case :
M-l
emacs --daemon
to run in the background.
emacsclient.emacs24 <filename/dirname>
to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
C-/
C-?
M-c
2. Upper Case : M-u
M-l
# Python implementation of Aho-Corasick string matching | |
# | |
# Alfred V. Aho and Margaret J. Corasick, "Efficient string matching: an aid to | |
# bibliographic search", CACM, 18(6):333-340, June 1975. | |
# | |
# <http://xlinux.nist.gov/dads//HTML/ahoCorasick.html> | |
# | |
# Copyright (C) 2015 Ori Livneh <[email protected]> | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); |
One of the many reasons I love working with Ruby is it has a rich vocabulary that allows you to accomplish your goals with a minimal amount of code. If there isn't a method that does exactly what you want, it's usually possible to build an elegant solution yourself.
Let's take the example of simulating the rolling of a die.
We can represent a die as an array of its faces.
die = [*?⚀..?⚅]
# => ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
Steps to get Rails 4 saving its output to Syslog via Rsyslog. This assumes you are on CentOS
, but should be pretty adaptable to any other distribution. Ruby 2.0+
is also required.
lograge
and logstash-event
to your Gemfile
. Feel free to remove from production
if you'd like to test it in development
as well or something.production.rb
with the lograge
settings and set the logger
to Syslog::Logger
.conf
files to /etc/rsyslog.d/
. /etc/rsyslog.conf
should have $IncludeConfig /etc/rsyslog.d/*.conf
enabled, so it will load any additional configs from /etc/rsyslog.conf
.{ | |
"directory": "vendor/bower_components" | |
} |
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
#!/bin/bash | |
### USAGE | |
### | |
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7 | |
### ./ElasticSearch.sh will fail because no version was specified (exit code 1) | |
### | |
### CLI options Contributed by @janpieper | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch |
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
# Postgresql fancy datatypes! | |
* array | |
* hstore (=~ hash) | |
* json | |
* jsonb | |
Philippe Creux - [@pcreux](http://twitter.com/pcreux) |