Skip to content

Instantly share code, notes, and snippets.

View LispyAriaro's full-sized avatar

Efe Ariaroo LispyAriaro

  • London, United Kingdom
View GitHub Profile
@LispyAriaro
LispyAriaro / gist:ee5eea83a0df359e4989ae51d68c058d
Created April 9, 2016 07:50
VLC plugin - delete currently playing file
--[[
INSTALLATION (create directories if they don't exist):
- put the file in the VLC subdir /lua/extensions, by default:
* Linux (all users): /usr/share/vlc/lua/extensions/
* Linux (current user): ~/.local/share/vlc/lua/extensions/
* Mac OS X (all users): /Applications/VLC.app/Contents/MacOS/share/lua/extensions/
* Windows: not supported - getting permission error on delete...
- Restart VLC.
]]--
@LispyAriaro
LispyAriaro / 0_reuse_code.js
Created January 5, 2016 09:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@LispyAriaro
LispyAriaro / gist:803e5e37cb735da6dbb8
Last active September 17, 2015 01:16 — forked from flyingmachine/gist:4004807
clojure korma heroku db connection
(defdb db
(if (System/getenv "DATABASE_URL")
(let [db-uri (java.net.URI. (System/getenv "DATABASE_URL"))
user-and-password (clojure.string/split (.getUserInfo db-uri) #":")]
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:user (get user-and-password 0)
:password (get user-and-password 1) ; may be nil
:subname (if (= -1 (.getPort db-uri))
(format "//%s%s" (.getHost db-uri) (.getPath db-uri))
(defn get-largest-products
([input-nums]
(get-largest-products input-nums 0 []))
([input-nums curr-index so-far]
(if (== (count input-nums) (count so-far))
so-far
(let [multiply-val (input-nums curr-index)
multiples (for [i (range (count input-nums))
:when (not= i curr-index)]
(* multiply-val (input-nums i)))
efeariaroo@efeariaroo-HP-Compaq-6720s:~/Documents/PROJECTS/ERLANG/bson-erlang$ git branch
* master
efeariaroo@efeariaroo-HP-Compaq-6720s:~/Documents/PROJECTS/ERLANG/bson-erlang$ git checkout 6d92bf4bc16b6b2c1d3bd58be2745048b91bf0a6
Note: checking out '6d92bf4bc16b6b2c1d3bd58be2745048b91bf0a6'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
@LispyAriaro
LispyAriaro / DD.jl
Last active August 29, 2015 14:20 — forked from kmsquire/DD.jl
module DD
import Base: similar, sizehint, empty!, setindex!, getindex, get,
pop!, delete!, start, next, done, isempty, length
export DefaultDict
type DefaultDict{K,V,F} <: Associative{K,V}
d::Dict{K,V}
@LispyAriaro
LispyAriaro / DD.jl
Last active August 29, 2015 14:20 — forked from kmsquire/DD.jl
module DD
import Base: similar, sizehint, empty!, setindex!, getindex, get,
pop!, delete!, start, next, done, isempty, length
export DefaultDict
type DefaultDict{K,V,F} <: Associative{K,V}
d::Dict{K,V}
public void DisableAllButtons()
{
if (true)
{
int firstNum = 10;
}
int firstNum = 5;
//error message shown by visual studio
//A local variable named 'firstNum' cannot be declared
//in this scope because it would give a different meaning to 'firstNum'
(ns three.demo)
(def camera (THREE.Camera. 75 (/ window/innerWidth
window/innerHeight) 1 10000))
(set! (.z (.position camera)) 1000)
(def scene (THREE.Scene.))
(def geometry (THREE.CubeGeometry. 200 200 200))
(def obj (js/Object.))
(set! (.color obj) 0xff0000)
(set! (.wireframe obj) true)
(def material (THREE.MeshBasicMaterial. obj))
;How to count all occurrences of 42?
(count (filter #{42} coll))
;How to express count using reduce?
(defn my-count [coll] (reduce (fn [n _] (inc n)) 0 coll))
;How to count all occurrences of 42 using reduce?
(reduce (fn [n _] (inc n)) 0 (filter #{42} coll))
;Can you get rid of the filter?