Skip to content

Instantly share code, notes, and snippets.

View alexy's full-sized avatar

Alexy Khrabrov alexy

View GitHub Profile
import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}
@jonathantneal
jonathantneal / README.md
Last active March 24, 2025 17:47
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
class Deps {
// scala language dependencies
def scalaCompiler = scalaVersion map ("org.scala-lang" % "scala-compiler" % _)
def scalaReflect = scalaVersion map ("org.scala-lang" % "scala-reflect" % _)
def scalaParsers = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
def scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
// java dependencies
def ant = "org.apache.ant" % "ant" % "1.9.4"
def asm = "org.ow2.asm" % "asm-debug-all" % "5.0.1"
#!/bin/bash
# tungsten-slave-createcachetables.sh
# Tungsten is not extracting data for the following pattern (Drupal 6 and 7):
# replicator.filter.replicate.ignore=*.access,*.cache,*.cache_*,*.ctools_*_cache,*.views_*_cache,*.sessions,*.watchdog
# This means that the tables would not exist on the slave. It would be ideal to have
# the tables exist, but be empty.
# This script will create empty tables for any table matching the pattern in 'grep' commands below.
# It is manually set to match the same replicator.filter.replicate.ignore in the tungsten config.
@russch
russch / gist:7451465
Created November 13, 2013 15:59
Automatically refresh a Tableau viz on Tableau Server
<!DOCTYPE html>
<html>
<title>I'm an HTML file!</title>
<!-- Replace the reference to the JS API on Tableau Public to your server -->
<script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
@luajalla
luajalla / Console.fs
Created October 10, 2013 19:52
REngine initialization (Mono + OSX, R 2.15 32bit) - Console app works - Type provider crashes (added a script file with #r to it)
namespace rtest
open System
open RDotNet
[<AutoOpen>]
module Init =
let initR() =
let rpath = "/Library/Frameworks/R.framework/Libraries"
let rresources = "/Library/Frameworks/R.framework/Resources"
@milessabin
milessabin / gist:6707525
Created September 25, 2013 23:14
New in shapeless 2.0.0-SNAPSHOT (post M1): lazy recursive implicit values ... normally you would expect the recursion between List[T] and Cons[T] to cause the implicit resolution for Show[T] to blow up with a diverging implicit expansion.
import shapeless._
sealed trait List[+T]
case class Cons[T](hd: T, tl: List[T]) extends List[T]
sealed trait Nil extends List[Nothing]
case object Nil extends Nil
trait Show[T] {
def apply(t: T): String
}
@propensive
propensive / extraction.scala
Last active July 26, 2017 15:06
Example of automatic case class extraction from JSON using Rapture JSON 0.9.2
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import rapture.core._
import rapture.core._
scala> import rapture.json._
import rapture.json._
@folone
folone / gist:6089236
Last active January 4, 2025 10:32
Table of unicode operators in scalaz 6.0.x
@krishnanraman
krishnanraman / zipcodes of wealthy elite
Last active December 20, 2015 06:09
Where do the WEALTHY WELL EDUCATED ELITE live ?
/*
Goal: Use Scalding to datamine the 2010 US Census data (kindly provided by @ElonAzoulay & @hmason), to find
Where do the WEALTHY WELL EDUCATED ELITE live ?
WEALTHY == house value quarter million, household income 150k
WELL EDUCATED == sort by edu, edu = (10 * Phd + 5 * MS + 1 * BS) score
*/
import com.twitter.scalding._
import cascading.tuple.Fields
import cascading.tap.SinkMode