Skip to content

Instantly share code, notes, and snippets.

View shyamsalimkumar's full-sized avatar

Shyam S Kumar shyamsalimkumar

  • Berlin
  • 22:43 (UTC +01:00)
View GitHub Profile
@shyamsalimkumar
shyamsalimkumar / Field.scala
Last active February 23, 2017 18:45
Trying annotating a constructor parameter `class A(@field("first_field") val a: String)`
import scala.collection.immutable.Seq
import scala.meta._
class Field(fieldName: String) extends scala.annotation.StaticAnnotation {
inline def apply(defn: Any): Any = meta {
val fieldName = this match {
case q"new $_(${Lit(tableName: String)})" => tableName
case _ => abort("@Field expects a string to be provided")
}
defn match {

The following lines correspond to the output of lines 79-82. I just get an infinite loop instead. I presume that node elements first child node.FirstChild's parent ie node.FirstChild.Parent would be node itself rather than node.Parent.

Since the heirarchy is div.color_picker > div.over_wrap. Its probably some Golang concept that I've over looked or something silly that I can't seem to notice. What am I doing wrong?

####Expected result

actual parent
@shyamsalimkumar
shyamsalimkumar / sstable-format-version-numbers.md
Last active March 14, 2023 21:59
Cassandra SSTable Format Version Numbers

Original Source

Finding all sstables not matching version “ib”

find /var/lib/cassandra/data/ -type f | grep -v -- -ib- | grep -v "/snapshots"

The version numbers, to date are:

Version 0

@shyamsalimkumar
shyamsalimkumar / err.log
Created August 17, 2015 12:46
Spark serialization error
15/08/17 16:24:21 ERROR Executor: Exception in task 0.0 in stage 7.0 (TID 7)
java.io.NotSerializableException: com.acme.avro.Swipe
Serialization stack:
- object not serializable (class: com.acme.avro.Swipe, value: {"center_id": 1, "gate_id": 2, "employee_id": 1597, "card_id": 12575632, "employee_name": "Anju Chandran", "swipe_time": 0, "coming_in": true})
- field (class: scala.Tuple2, name: _2, type: class java.lang.Object)
- object (class scala.Tuple2, ([B@6c0e6da7,{"center_id": 1, "gate_id": 2, "employee_id": 1597, "card_id": 12575632, "employee_name": "Anju Chandran", "swipe_time": 0, "coming_in": true}))
- element of array (index: 0)
- array (class [Lscala.Tuple2;, size 1)
at org.apache.spark.serializer.SerializationDebugger$.improveException(SerializationDebugger.scala:40)
at org.apache.spark.serializer.JavaSerializationStream.writeObject(JavaSerializer.scala:47)
@shyamsalimkumar
shyamsalimkumar / User.scala
Created August 7, 2015 18:30
Case class and implicit mapper
package com.acme.spark.trial.dto
import com.datastax.spark.connector.mapper.DefaultColumnMapper
/**
* Class to represent a User
*/
case class User(userId: Int, firstName: String, lastName: String)
object User {
@shyamsalimkumar
shyamsalimkumar / classicalModel.js
Created July 4, 2014 18:08
JavaScript Inheritance models
// Declare the constructor
var Human = function ( name ) {
this._name = name;
};
// Method to get the human's name
Human.prototype.getName = function () {
return this._name;
};
@shyamsalimkumar
shyamsalimkumar / bind.js
Created February 18, 2014 18:08
Helper method to set the value of 'this'
/**
* Helper method to set the value of 'this'.
* @param {Object} thisObject The value of 'this' to be set.
* @return {Function} Function whose this is to be set with custom this set.
*/
Function.prototype.bind = function ( thisObject ) {
var that = this;
return function () { that.apply( thisObject, arguments ); };
.transform(@string) {
-webkit-transform: @string;
-moz-transform: @string;
-ms-transform: @string;
-o-transform: @string;
transform: @string;
}
.rotate(@deg) {
-webkit-transform: rotate(@deg);
"""Traffline ETA
Usage:
traffline.py <source> <destination> <city>
"""
from docopt import docopt
import requests
import json
/* Social Media Brand Colors
twitter: #00aced rgb(0, 172, 237)
facebook: #3b5998 rgb(59, 89, 152)
googleplus: #dd4b39 rgb(221, 75, 57)
pinterest: #cb2027 rgb(203, 32, 39)
linkedin: #007bb6 rgb(0, 123, 182)
youtube: #bb0000 rgb(187, 0, 0)
vimeo: #aad450 rgb(170, 212, 80)
tumblr: #32506d rgb(50, 80, 109)