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
[jgalang@rashomon:~/Code/skunkworks/2fa] | |
∴ ruby totp_demo.rb | |
Time(sec) Time (UTC format) Value of T(Hex) TOTP Mode OK | |
------------------------------------------------------------------------------------------ | |
59 1970-01-01 00:00:59 0000000000000001 94287082 SHA1 ✔ | |
59 1970-01-01 00:00:59 0000000000000001 46119246 SHA256 ✔ | |
59 1970-01-01 00:00:59 0000000000000001 90693936 SHA512 ✔ | |
1111111109 2005-03-18 01:58:29 00000000023523EC 07081804 SHA1 ✔ | |
1111111109 2005-03-18 01:58:29 00000000023523EC 68084774 SHA256 ✔ |
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
.form-actions | |
- if params[:action] == "new" | |
= button_tag type: "submit", class: "btn btn-success btn-cons", | |
id: "submit" do | |
= fa_icon "check" | |
%span Create | |
= link_to courses_path, class: "btn btn-danger btn-cons" do | |
= fa_icon "close" | |
%span Cancel |
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
print "Enter an integer number to be calculated as factorial: " | |
Integer(gets) rescue print "Hey, that's not an integer! Enter an integer, please: " | |
n = gets.to_i | |
def factorial n | |
n > 1 ? n * factorial(n - 1) : 1 | |
end | |
puts "Factorial of number #{n} is #{factorial(n)}" |
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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'savon' | |
require 'csv' | |
startDate = Date.new(2004, 01, 01) | |
stopDate = Date.today | |
csvHeaders = ['numar', 'numar_vechi', 'data', 'institutie', 'departament', | |
'categorie_caz', 'stadiu_procesual', 'obiect', 'data_modificare','nume','calitate_parte','solutie'] |
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
1.9.3p392 :002 > Postcode | |
=> Postcode(id: integer, postcode: string, long: decimal, lat: decimal, address: string, bias: string, data: text, tries: integer, updated_at: datetime, created_at: datetime) | |
1.9.3p392 :003 > |
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
AppUser.authenticate('ADMIN', '') | |
AppUser Load (0.9ms) EXEC sp_executesql N'SELECT TOP (1) [AppUsers].* FROM [AppUsers] WHERE [AppUsers].[UserID] = N''ADMIN'' AND [AppUsers].[Password] = N'''' ORDER BY [AppUsers].[UserID] ASC' | |
=> #<AppUser UserID: "ADMIN", UserName: "Administrator", MenuGroup: "SYS_ADMIN", Password: "", DefaultStoreID: "1", FullRights: true, LastChanged: "2013-10-23 17:59:52", ChangedBy: "ADMIN", Email: "", Phone: "", Deleted: false, CashierID: "", HideCostPrice: false, WebLogin: false, CustomerID: "", DepID: "", NetworkID: ""> |
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
search_all = LOCAL_SETTINGS["single_site_search"] | |
if params[:ref].present? | |
spaces = Space.where(id: { params[:ref] }, parent_id: nil }) | |
spaces = spaces.eager_loads(slots: :companies).where(companies: { parent_id: current_company_id }) unless search_all | |
render partial: 'call_centre_results' and return | |
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
# Variable substitution works here | |
foo: "The quick brown %{ animal } jumped over the lazy dog" | |
# Variable substitution done not work here | |
# Instead, "%{ animal }" gets rendered | |
bar: "The quick | |
brown %{ animal } | |
jumped over | |
the lazy dog" |
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
class JTask | |
# JTask.find() | |
# Retrieves records from the database file. | |
# -------------------------------------------------------------------------------- | |
# Eg: JTask.find("test.json", 1) || JTask.find("test.json", first: 10) | |
# #=> <JTask id=x, ...> | |
# -------------------------------------------------------------------------------- | |
# See wiki guide for more usage examples... | |
# https://github.com/adammcarthur/jtask/wiki/find |
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
class Widget < ActiveRecord::Base | |
attr_accessible :name, :snippets, :snippets_attributes, :company_id, :hostname, :first_page, :affiliate_id, :item_defaults, :read_only | |
has_many :snippets | |
has_many :permissions, dependent: :destroy | |
has_many :users, through: :permissions | |
accepts_nested_attributes_for :snippets | |
attr_accessor :read_only | |
def read_only | |
true |
NewerOlder