Skip to content

Instantly share code, notes, and snippets.

View asimjalis's full-sized avatar

Asim Jalis asimjalis

View GitHub Profile
@athos
athos / deps.edn
Last active June 2, 2024 08:57
Try on your terminal `clojure -Sdeps '{:deps {hello-clojure/hello-clojure {:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202" :git/sha "099bdf7d565b2c35c1df601abf58514cc5276237"}}}' -M -m hello-clojure`
{:paths ["."]
:deps {clansi/clansi {:mvn/version "1.0.0"}}}
@depp
depp / problem.cpp
Last active December 21, 2021 19:04
A Faster Solution
// Faster solution for:
// http://www.boyter.org/2017/03/golang-solution-faster-equivalent-java-solution/
// With threading.
// g++ -std=c++11 -Wall -Wextra -O3 -pthread
// On my computer (i5-6600K 3.50 GHz 4 cores), takes about ~160 ms after the CPU
// has warmed up, or ~80 ms if the CPU is cold (due to Turbo Boost).
// How it works: Start by generating a list of losing states -- states where the
// game can end in one turn. Generate a new list of states by running the game
@MHM5000
MHM5000 / allah-names
Last active July 20, 2017 14:20
Allah names ready to be used in JavaScript or any other language
الرَّحْمَنُ
الرَّحِيمُ
الْمَلِكُ
الْقُدُّوسُ
السَّلاَمُ
الْمُؤْمِنُ
الْمُهَيْمِنُ
الْعَزِيزُ
الْجَبَّارُ
الْمُتَكَبِّرُ
@theanalyst
theanalyst / codegen.py
Last active October 19, 2018 18:38
The beginnings of a py2hy code generator
import ast
from functools import partial, wraps
DEFAULT_INDENTATION = 2
def enclose(parens,newline=False):
def decorate(func):
@wraps(func)
def wrapper(self,*args,**kwargs):
(defn postfix [& e]
(reduce #(if (fn? %2)
(let [[l r & m] %]
(cons (%2 r l) m))
(cons %2 %)) [] e))
@mjg123
mjg123 / ajax.cljs
Created July 21, 2011 22:43
How to make a json(p) request from ClojureScript using jQuery
(def jquery (js* "$"))
(defn show [msg]
(let [data-as-json ((js* "JSON.stringify") msg nil 4)]
((js* "alert") data-as-json)))
(defn make-js-map
"makes a javascript map from a clojure one"
[cljmap]
(let [out (js-obj)]
@ryancrum
ryancrum / jquerytest.cljs
Created July 21, 2011 02:24
How to use jQuery from ClojureScript
(ns jquerytest.core)
(def jquery (js* "$"))
(jquery
(fn []
(-> (jquery "div.meat")
(.html "This is a test.")
(.append "<div>Look here!</div>"))))
@sroysf
sroysf / herokuUbuntuGettingStarted.md
Created July 15, 2011 01:29
Getting started with Heroku client on Ubuntu 10.04

Getting started with Heroku client on Ubuntu 10.04

Note : This actually does work on a GSE Linux box as well.

First, prepare your system with all the libraries needed for Ruby / RVM. You will need to pay attention to the output from aptitude as it resolves the various dependencies. You may or may not have conflicts depending on your specific system setup. Make sure that you agree with what aptitude is about to do before proceeding.

sudo aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git 
sudo aptitude install zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev 
sudo aptitude install sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev subversion
;; When executed, this file will run a basic web server
;; on http://localhost:8080, which will tell you how many
;; times you have visited the page.
(ns ring.example.session
(:use ring.middleware.session
ring.util.response
ring.adapter.jetty))
(defn handler [{session :session, uri :uri}]