Skip to content

Instantly share code, notes, and snippets.

@dfuenzalida
dfuenzalida / detective_conan.py
Created October 8, 2012 01:17
Detective Conan en DailyMotion
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Parsea la página de busquedas de DailyMotion para encontrar
# episodios de Detective Conan, busca las URL y las imprime,
# para usar junto con JDownloader
import urllib2
import time
from BeautifulSoup import BeautifulSoup
@dfuenzalida
dfuenzalida / fizzbuzz.clj
Created April 8, 2013 14:17
The FizzBuzz problem in "moderately idiomatic" Clojure
(defn fizzbuzz
"Prints the numbers from 1 to 100. But for multiples of three prints
'Fizz' instead of the number and for the multiples of five prints
'Buzz'. For numbers which are multiples of both three and five prints
'FizzBuzz'"
[]
(doall
(map
#(println
(some
@dfuenzalida
dfuenzalida / youtube-api-play-pause.html
Created December 9, 2013 21:14
Creating several YouTube videos, play and pause using JS
<div id="player-TMoPuv-xXMM"></div>
<hr/>
<div id="player-bpOR_HuHRNs"></div>
<a href="#" id="pause">Pause</a>
<a href="#" id="resume">Resume</a>
<script src="http://www.youtube.com/player_api"></script>
<script>
// 3. This function creates an <iframe> (and YouTube player)
(ns clj-odfdom.core
(:import [org.odftoolkit.odfdom.doc OdfTextDocument]))
;; Based on http://stackoverflow.com/a/13107088/483566
(defn -main [& args]
(let [document (OdfTextDocument/loadDocument "test.odt")
texts (.getTextContent (.getContentRoot document))]
(println texts)))
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
(ns cross-of-zeroes.core)
;; HOWTO:
;; Create a project with:
;;
;; $ lein new cross-of-zeroes
;;
;; and replace src/cross_of_zeroes/core.clj with this file.
;;
;; Output of lein run:
(defn fb [n]
(take n
(map (fn [a b] (get (hash-map a b) "" a))
(map str
(cycle ["" "" "Fizz"])
(cycle ["" "" "" "" "Buzz"]))
(rest (range)))))
;; Usage:
;; user=> (fb 20)
@dfuenzalida
dfuenzalida / output
Created July 21, 2015 02:37
cljs-modern tutorial step 1
C:\Functional_Languages\modern-cljs>lein cljsbuild once
Compiling ClojureScript.
←[33mWARNING: It appears your project does not contain a ClojureScript dependenc
y. One will be provided for you by lein-cljsbuild, but it is strongly recommende
d that you add your own. You can find a list of all ClojureScript releases here
:
http://search.maven.org/#search|gav|1|g%3A%22org.clojure%22%20AND%20a%3A%22cloju
rescript%22
You're using [lein-cljsbuild "1.0.0"], which is known to work well with ClojureS
@dfuenzalida
dfuenzalida / alt.clj
Created August 29, 2016 01:57
Leiningen Multiple Mains
(ns manymains.alt
(:gen-class))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World from Alt!"))
@dfuenzalida
dfuenzalida / xchart-session.repl
Created May 28, 2017 17:11
xchart session.repl
;; Linux 4.4.0-77-generic on Ubuntu 16.04.2 LTS
;; Cloned the git repo from https://github.com/stuarthalloway/clj-xchart
(require '[clojure.edn :as edn])
(require '[com.hypirion.clj-xchart :as xchart])
(def args (edn/read-string (slurp "examples/problem1.edn")))
(xchart/view (apply xchart/bubble-chart* args))
;; Running the above on
;; Java HotSpot(TM) 64-Bit Server VM 1.8.0_131-b11