This file contains 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
; See revision version 1 for non-phantomJS version, setup phantomJS here: http://blog.zolotko.me/2012/12/clojure-selenium-webdriver-and-phantomjs.html | |
(use 'clj-webdriver.taxi) | |
(import 'org.openqa.selenium.phantomjs.PhantomJSDriver | |
'org.openqa.selenium.remote.DesiredCapabilities) | |
(use '[clj-webdriver.driver :only [init-driver]]) | |
; skip this section until 'lawl' comment | |
(use '[clj-webdriver.core :only [execute-script*]]) |
This file contains 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
nnoremap <F2> :set invpaste paste?<CR> | |
imap <F2> <C-O><F2> | |
set pastetoggle=<F2> | |
set incsearch | |
set ignorecase | |
set smartcase | |
set scrolloff=2 | |
set wildmode=longest,list | |
set showcmd |
This file contains 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
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond $1 !^(index\.php|imgs|js|css|flex|public|robots\.txt) | |
RewriteRule ^(.*)$ /index.php?/$1 [L] |
This file contains 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 collections | |
import string | |
def rotate(lst, amount): | |
items = collections.deque(lst) | |
items.rotate(amount) | |
return items | |
def rotate_str(str, amount): | |
return ''.join(rotate(str, amount)) |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%"> | |
<s:layout> | |
<s:VerticalLayout paddingLeft="10" paddingRight="10" paddingBottom="10" paddingTop="10" /> | |
</s:layout> | |
<fx:Declarations> | |
</fx:Declarations> | |
<s:TextArea id="norm" change="alter();" width="100%" height="100%" /> |
This file contains 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 | |
# Prints out (highly likely at least) 64 random characters, along with some truncations for common password length limits. | |
# Shows random characters in the printable set as well as just alpha-numeric. | |
# get rid of -s flag if you want to see what you type | |
# (possible enhancement for people who typo a lot: read into $p2 as well and only proceed if the entries are equal.) | |
read -s p | |
hash=`echo -n $p | sha256sum | sed -e 's/-//' | sed -e 's/ //'` | |
hash=`python -c "import random, sys, struct; random.seed(0x$hash); bits=[random.getrandbits(64) for i in range(200)]; sys.stdout.write(struct.pack('Q'*len(bits), *bits)); print"` | |
hash2=`echo $hash | tr -cd "[:graph:]" | head -c ${1:-64}` |
This file contains 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 RepositoryHolder getRepositories() throws AppException { | |
final String query = "select id, repo_url from localdb.sys_network.repositories"; | |
List<Repository> repo_list = new ArrayList<Repository>(); | |
Repository master = new Repository(); | |
DB.execute(query, master, repo_list); | |
RepositoryHolder ret = new RepositoryHolder(); | |
ret.repositories = repo_list; |
This file contains 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
; listing 1.4: group | |
(defn group [coll n] | |
(if (zero? n) | |
(throw (Exception. "zero length")) | |
(partition-all n coll))) | |
; listing 1.5: flatten | |
; built-in | |
; listing 1.6: fact-and-choose |
This file contains 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
# Is this a stupid pattern? | |
def clipboard(text=None): | |
''' | |
Given no argument, returns the contents of the system clipboard or | |
None if empty. | |
Given an argument string, sets that as the value of the system clipboard and | |
returns the given string. | |
Note: The presence of calling this function will result in the system | |
clipboard being flushed on program termination. |
This file contains 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
; pro-tip: run "java -jar clojure.jar ai.clj >> ai.clj" for infinite fun! | |
(println ((fn [x y] (list (quote println) (list x (list (quote quote) x) (inc y)))) (quote (fn [x y] (list (quote println) (list x (list (quote quote) x) (inc y))))) 1)) |
OlderNewer