This file contains hidden or 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
<!DOCTYPE html><html class="no-touch" lang="en"><head><meta charset="utf-8" /><title>Mobile first web app theme | first</title><meta content="mobile first, app, web app, responsive, admin dashboard, flat, flat ui" name="description" /><meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport" /><link rel="stylesheet" media="all" href="/assets/bootstrap.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/font-awesome.min.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/font.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/plugin.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/style.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/landing.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/app.css?body=1" /> | |
<link rel="stylesheet" media="all" href="/assets/application.css?body=1" /><script src="/assets/jquery.js?body=1"></script> | |
<script src="/assets/angular.js?body=1"></script> | |
<script src="/assets/an |
This file contains hidden or 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
var rBusApp = angular.module('rBusApp', ['restangular','ui.router']); | |
rBusApp.config(["$stateProvider", "$urlRouterProvider", function($stateProvider, $urlRouterProvider) { | |
$urlRouterProvider.otherwise('/'); | |
$stateProvider. | |
state('index', | |
{url: '/', templateUrl: "landing.html", controller: 'landingController'} | |
). | |
state('routes', |
This file contains hidden or 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
doctype html | |
html.no-touch[lang="en"] | |
head | |
meta[charset="utf-8"] | |
title | |
| Mobile first web app theme | first | |
meta[name="description" content="mobile first, app, web app, responsive, admin dashboard, flat, flat ui"] | |
meta[name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"] | |
= stylesheet_link_tag 'application', media: 'all' | |
= javascript_include_tag 'application' |
This file contains hidden or 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
(Original here http://www.poetryfoundation.org/poem/171612) | |
Did I ever tell you that Programmer McCave | |
Had twenty-three variables and he named them all `a` | |
Well, he did. And that wasn't a smart thing to do. | |
You see, when he wants wants to add `a` to 2 | |
He doesn't get a number oh no no no | |
All twenty-three `a`s cause a buffer overflow |
This file contains hidden or 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
require 'rspec' | |
require 'aws-sdk-core' | |
require 'awesome_print' | |
require 'pry-byebug' | |
ks = [:creation_date, :name] | |
class AwsResponse < Struct.new(*ks) | |
end | |
This file contains hidden or 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
# why not? | |
def power(n) | |
2 ** n | |
end | |
# if you must do it the brute force way | |
def power(n) | |
return 1 if n == 0 | |
(1..[0,n-1].max).reduce(2) { |acc, n| acc * 2 } | |
end |
This file contains hidden or 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
# Given a table stat with primary key "slug" with data | |
# [{slug: 'foo', stats: {}}, {slug:'bar', stats:{}}] | |
updated_stats = { | |
'foo' => {a: 1, b: 2}, | |
'bar' => {a: 3, b: 4} | |
} | |
# I can do this | |
updated_stats.each{|k,v| |
This file contains hidden or 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
#Given an array of numbers i.e. [1,2,3...1000], find out all possible combinations that add up to any given number i.e. 51437 | |
#start with empty db | |
# start with 1st transaction -> write {key = 1, value => 1 } | |
# for the second transaction write { key => 1.2 => value => 3 } | |
# { key = 2, value => 3 } | |
# for the third transaction write { key => 1.2.3 => value => 6 } | |
# { key = 1.3, value => 4 } | |
# { key = 2.3, value => 5 } | |
# { key = 3, value => 3 } |
This file contains hidden or 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
# Assuming your execute command is more complex than a simple puts, | |
# you will need separate classes | |
class GoodbyeCommand | |
def execute | |
# complex logic here | |
end | |
end | |
class TwitterCommand |
This file contains hidden or 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
module GamesController | |
class Index < ControllerAction | |
def get | |
[200, {}, Game.all.to_json] | |
end | |
def params | |
super.except(:deleted_at) # no need for strong_params. specify what goes and what doesn't by overriding the params |
NewerOlder