This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check out the where clause of the Generic | |
// Also the `_` | |
func anyCommonElements <T, U where T: SequenceType, U: SequenceType, T.Generator.Element: Equatable, T.Generator.Element == U.Generator.Element> (lhs: T, _ rhs: U) -> Bool { | |
} | |
// should the function be invoked or is this an error | |
anyCommonElements(["a", "b", "c"], [1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Single-line version: | |
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)/)(?:[^\s()<>{}\[\]]+|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sample output for 5742 | |
# feel free to give more sensible / interesting names to KSs and CFs ordering is based on time of creation of the KS/CF. | |
lyubent:bin lyubentodorov$ ./nodetool listsnapshots | |
Snapshot Details: | |
Snapshot name Keyspace name Column family name True size Size on disk | |
1393952912539 europe resources 3.44 MB 3.46 MB | |
1393952912539 europe countries 0 bytes 16.86 MB | |
1393952912539 asia countries 0 bytes 16.41 MB | |
1393952912539 northamerica countries 0 bytes 16.17 MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CqlLexer(RegexLexer): | |
""" | |
Lexer for Cassandra Query Language. | |
Spec available `here<https://cassandra.apache.org/doc/cql3/CQL.html>`_. | |
""" | |
name = 'CQL' | |
aliases = ['cql'] | |
filenames = ['*.cql'] | |
mimetypes = ['text/x-sql'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.cstar; | |
import com.datastax.driver.core.Cluster; | |
import com.datastax.driver.core.Row; | |
import com.datastax.driver.core.Session; | |
public class MyClient { | |
public MyClient() { | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
al3xandru $ curl -I -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.76.4 (KHTML, like Gecko) Version/7.0.4 Safari/537.76.4" http://t.co/QgPZfAwK0z | |
HTTP/1.1 200 OK | |
cache-control: private,max-age=300 | |
content-length: 0 | |
content-type: text/html; charset=utf-8 | |
date: Sat, 24 May 2014 19:00:20 GMT | |
expires: Sat, 24 May 2014 19:05:20 GMT | |
server: tfe | |
set-cookie: muc=acc5d3c2-431f-4f4d-84ba-7e48d3c7edbd;Domain=t.co;Expires=Thu, 05-May-2016 19:00:20 GMT | |
x-xss-protection: 1; mode=block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<connectionList> | |
<connections> | |
<name>Cassandra 2.0.7</name> | |
<hosts>NODE IP</hosts> | |
<port>9042</port> | |
<compression>NONE</compression> | |
<requiresCredentials>false</requiresCredentials> | |
<ssl>false</ssl> | |
<storePassword>false</storePassword> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var record_visit = function(req, res){ | |
/* Connect to the DB and auth */ | |
require('mongodb').connect(mongourl, function(err, conn){ | |
conn.collection('ips', function(err, coll){ | |
/* Simple object to insert: ip address and date */ | |
object_to_insert = { 'ip': req.connection.remoteAddress, 'ts': new Date() }; | |
/* Insert the object then print in response */ | |
/* Note the _id has been created */ | |
coll.insert( object_to_insert, {safe:true}, function(err){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
tell application "Finder" | |
set sel to selection | |
if (count sel) > 0 then | |
set myTarget to item 1 of sel | |
else if (count window) > 0 then | |
set myTarget to target of window 1 | |
else | |
set myTarget to path to home folder | |
end if |
OlderNewer