(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| val sqlContext = new org.apache.spark.sql.SQLContext(sc) // optional | |
| val df = sqlContext.load("jdbc", Map( | |
| "url" -> "jdbc:mysql://<ip.address.your.db>/<table>?user=<username>&password=<pwd>", | |
| "dbtable" -> "<tablename>")) | |
| df.select("<col1>","<col2>","<col3>").save("</path/to/parquet/file.parquet>","parquet") | |
| //Alternatively, to save all the columns: |
| # not for production, obviously | |
| def hash(str, length_of_hash = 20) | |
| added = str.codepoints.map(&:ord).each_slice(length_of_hash).inject do |a, b| | |
| a.map.with_index { |c, d| (c + (b[d] || 0)) % 256 } | |
| end | |
| added.map { |val| val.to_s(16) }.join | |
| end |
| export class EnumSymbol { | |
| sym = Symbol.for(name); | |
| value: number; | |
| description: string; | |
| constructor(name: string, {value, description}) { | |
| if(!Object.is(value, undefined)) this.value = value; | |
| if(description) this.description = description; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // [B](f: (A) ⇒ [B]): [B] ; Although the types in the arrays aren't strict (: | |
| Array.prototype.flatMap = function(lambda) { | |
| return Array.prototype.concat.apply([], this.map(lambda)); | |
| }; |
| task showConfigurations << { | |
| new File("graph/configurations.dot").withWriter { out -> | |
| out.println "digraph configurations {" | |
| out.println "rankdir=BT;" | |
| configurations.all { con -> | |
| out.println "${con.name} [shape=box];" | |
| con.extendsFrom.each { ext -> | |
| out.println "${con.name} -> ${ext.name};" | |
| } | |
| } |
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
| /* Random Boolean */ | |
| var randomNumber = Math.random() >= 0.5; | |
| console.log(randomNumber); |
| Hey! Just to let you know there is a much better version of this script that doesn't require jQuery here: | |
| https://gist.github.com/edadams/5ce1ec3d0b1f69e80724af7eb3b606f4 | |
| For posterity, and because this Gist got unexpectedly popular for a random code snippet, I will preserve the original below. Please do know that I've figured out a much better way to do this, which is above. | |
| $(function(){ // shorthand document.ready() | |
| $('.make_lightbox').each(function(){ // this is just an element I let them click, it carries a series of data- attributes. | |
| $(this).on('click',function(){ // when clicked. this is the newer jQuery click() handler that's only in v1.8+ so that may be something to note. | |
| var lbArray = []; // create blank array. | |
| var arrayContents = {"width":$(this).data('width'), "height":$(this).data('height'), "low_res":$(this).data("lowres"), "high_res":$(this).data('highres')}; // make set of the data- attributes. |
| Summary: A high-level language, primarily intended for numerical computations | |
| Name: octave | |
| Version: 3.6.4 | |
| Release: 1.el6 | |
| #Epoch: 2 | |
| License: GPL | |
| Group: Applications/Mathematics | |
| URL: http://www.octave.org | |
| Source0: ftp://ftp.gnu.org/gnu/octave/octave-%{version}.tar.bz2 | |
| Source1: octave.png |