This file contains hidden or 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
| import matplotlib.pyplot as plt | |
| from matplotlib.colors import rgb2hex | |
| import matplotlib as mpl | |
| class BokehColorMapper(plt.cm.ScalarMappable): | |
| """A callable that maps cold colors to low values, and hot to high. | |
| """ | |
| def __init__(self, vmin=None,vmax=None, cmap=plt.cm.hot_r): | |
| norm = mpl.colors.Normalize(vmin=vmin, vmax=vmax) |
This file contains hidden or 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
| #!/bin/sh | |
| # Author: Nikita Kovalev, https://gist.github.com/maizy/c4d31c1f539694f721f6 | |
| # Based on: https://gist.github.com/visenger/5496675 | |
| # Use java7 dependency (openjdk) instead of java6. | |
| # Tested in Ubuntu 12.04.5 (precise) | |
| SCALA="2.11.2" | |
| SBT="0.13.5" |
This file contains hidden or 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
| HTTPoison.start | |
| urls = ["http://www.wikipedia.org","www.apple.com"] # or load your urls from a file | |
| urls |> Enum.map fn url -> HTTPoison.get!(url).status_code end | |
| # [200, 200] |
This file contains hidden or 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
| /** | |
| Usage: Just include this script after Marionette and Handlebars loading | |
| IF you use require.js add script to shim and describe it in the requirements | |
| */ | |
| (function(Handlebars, Marionette) { | |
| Marionette.Handlebars = { | |
| path: 'templates/', | |
| extension: '.handlebars' | |
| }; |
This file contains hidden or 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
| -- | a traversal that only return the concatenation of all the lists in the tree | |
| module Exam where | |
| data Ttree a = Nil | Node3 a (Ttree a) (Ttree a) (Ttree a) | |
| ttree= (Node3 [0] (Node3 [1,11] Nil Nil Nil) (Node3 [2,21] Nil Nil Nil) (Node3 [3,31] Nil Nil Nil)) | |
| concate_tree:: Ttree [a] -> [a] | |
| concate_tree t = concate_tree' t [] | |
| concate_tree':: Ttree [a] -> [a] -> [a] |
This file contains hidden or 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
| import java.io.IOException; | |
| import java.io.PrintWriter; | |
| import java.io.StringReader; | |
| import java.io.StringWriter; | |
| import java.io.UnsupportedEncodingException; | |
| import java.net.URLEncoder; | |
| import java.util.ArrayList; | |
| import javax.servlet.RequestDispatcher; |
This file contains hidden or 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
| :- module prime_factor. | |
| :- interface. | |
| :- import_module io. | |
| :- pred main(io::di, io::uo) is det. | |
| :- implementation. | |
| :- import_module list,solutions,int. | |
| % |
This file contains hidden or 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
| public bufferedImage load (String filepath ) { | |
| PlanarImage image = JAI.create("fileload","filepath"); | |
| BufferedImage bufferedImage = image.getAsBufferedImage(); | |
| return bufferedImage; | |
| } | |
| public void save (BufferedImage bufferedImage,String filepath,String format){ | |
| JAI.create("filestore",bufferedImage,"filepath","format"); | |
| } |