Skip to content

Instantly share code, notes, and snippets.

@sadhu89
sadhu89 / todo.md
Last active May 28, 2018 23:51
TODO
  • Allow a content block to be set for head content:
    • On views/layout/base/html.haml:
      • Replace all the content from inside the head tag with render_content_block(@cms_page.head_content_block_with_default.try(:slug)) (where @cms_page is an instance of Cms::PageConfiguration::PageWrapper)
    • Add head_content_block_with_default method to Cms::PageConfiguration::PageWrapper defined as:
    def head_content_block_with_default
      attribute_with_default(:head_content_block)
    end
  • Add a migration that adds a head_content_block_id to cms_full_pages and cms_rails_pages
import System.Random
turn :: Int -> Int -> IO ()
turn target n =
do if n == target
then putStrLn "You win!!!"
else do
if n < target
then putStrLn "Too small"
else putStrLn "Too big"
import System.Random
starman :: Int -> IO ()
starman n = do
g <- newStdGen
words = ["hello", "world", "haskell"]
word = words!!(fst (randomR (0,(length words) - 1) g))
turn word ['-' | x <- word] n
check :: String -> String -> Char -> (Bool, String)
check word display c
= ( c `elem` word, [if x == c
then c
else y | (x,y) <- zip word display])
turn :: String -> String -> Int -> IO ()
turn word display n =
do if n == 0
then putStrLn "You lose"
Pending: (Failures listed here are expected and do not affect your suite's status)
1) Store Locator Mobile initial page load
# pending finding a fix for poltergeist not loading google maps API
# ./spec/features/retailers/store_locator_mobile_spec.rb:35
2) Store Locator Mobile searching using the current location with no surrounding stores
# pending finding a fix for poltergeist not loading google maps API
# ./spec/features/retailers/store_locator_mobile_spec.rb:39
@sadhu89
sadhu89 / 0_reuse_code.js
Created March 13, 2016 18:46
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
@sadhu89
sadhu89 / ajax.js
Last active January 25, 2016 04:32
ajax.js
var root = 'http://jsonplaceholder.typicode.com';
var options;
$.ajax({
url: root + '/users',
method: 'GET',
async:false
}).then(function(data) {
options=data.map( u => u.username );
});
devices=Customer.collection.aggregate([
{
"$group" => {
_id: "$device_id",
count:{"$sum"=>1}
}
},
{
"$match"=>{
count:{"$gte"=>3}
@sadhu89
sadhu89 / .bashrc
Last active October 19, 2015 02:55
Dotfiles
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory