Skip to content

Instantly share code, notes, and snippets.

@arkiver
arkiver / 1_last_of_list.lisp
Last active August 29, 2015 13:56
Simple implementation(s) for finding last element from a list using Common Lisp.
(defun last-of-list (l)
"Returns last element of a list"
(nth (- (list-length l) 1) l))
@arkiver
arkiver / nth_element.lisp
Last active August 29, 2015 13:56
Purely recursive funtion to fetch nth element of list
(defun elek (lst n)
(if (= n 0)
(progn
(car lst))
(elek (rest lst) (- n 1))
)
)
;; CL-USER> (elek '(1 2 3 4) 2)
;; 3
@arkiver
arkiver / no-of-ele.lisp
Last active August 29, 2015 13:56
Return the no of elements in a list
(defun no-of-ele (lst)
"Return the no. of elements in a list"
(if (endp lst)
0
(progn (+ 1 (no-of-ele (rest lst))))
)
)
;; CL-USER> (no-of-ele '(1 2 3))
;; 3
@arkiver
arkiver / auto_scroll.js
Created March 13, 2014 11:07
Browse twitter/facebook handsfree :)
// run this in your browser's console
setInterval(function(){window.scrollBy(0, 1), 4000 })
// not well tested
irb(main):012:0> Date.today
=> Thu, 09 Jul 2015
irb(main):013:0> Date.tomorrow
=> Sat, 11 Jul 2015
irb(main):014:0> Date.today.tomorrow
=> Fri, 10 Jul 2015
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@arkiver
arkiver / wedding_ivr.php
Created April 13, 2012 11:05 — forked from kookoolib/wedding_ivr.php
KooKoo Wedding IVR
<?php
session_start();
require_once("response.php");//response.php is the kookoo xml preparation class file
$r = new Response();
$r->setFiller("yes");
$recore_wav="update";
if(isset ($_REQUEST['event']) && $_REQUEST['event']== "NewCall" )
{
$_SESSION['caller_number']=$_REQUEST['cid'];
$_SESSION['kookoo_number']=$_REQUEST['called_number'];
@arkiver
arkiver / check_for_current_page
Created September 10, 2012 09:10
Cucumber step defintion for sign in page
Generic definition for above definition:
Given /^I am on (.+)$/ do |page_name|
visit path_to(page_name)
end
@arkiver
arkiver / capybara cheat sheet
Created September 10, 2012 11:24 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@arkiver
arkiver / gist:3808133
Created September 30, 2012 18:52
emailer radial gradient
.center_container{
background-image: -webkit-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: -ms-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: -o-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: -moz-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
}