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 $1 | |
class $2 | |
$3 | |
end | |
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
// Event iterator for socket events | |
function socketEventIterator(event) { | |
let deferred | |
socket.subscribe(event, payload => { | |
if(deferred) { | |
deferred.resolve(payload) | |
deferred = null | |
} | |
} |
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
const { | |
createStore, | |
combineReducers, | |
applyMiddleware, | |
bindActionCreators | |
} = Redux | |
const { default: createSagaMiddleware, effects } = ReduxSaga | |
const { take, put, call, fork, join, cancel, race } = effects |
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
.panel.panel-default.devise-bs | |
.panel-heading.draggable drag=".login-screen" | |
h4.draggable.draggable drag=".login-screen" = t('.sign_in', :default => "Sign in") | |
.panel-body | |
= form_for(resource, as: resource_name, url: session_path(resource_name), html: { role: "form" }) do |f| | |
.form-group | |
= f.label :email | |
= f.email_field :email, autofocus: true, class: "form-control" | |
.form-group | |
= f.label :password |
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
# Если используется turbolink, запускаем скрипт после каждого обновления страницы | |
$(document).on 'turbolinks:load', -> | |
class Draggable | |
constructor: -> | |
@drag_element = null | |
@source_element = null | |
# Добавляем курсор с рукой для всех элементов с тэгом drag | |
# .grag { cursor: -webkit-grab } | |
$('[drag]').addClass('grab') |
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
$('<%= selector %>').replaceWith("<%= j content %>"); | |
<% unless location.nil? %> | |
window.history.pushState(null, null, '<%= location %>'); | |
console.log('<%= location %>'); | |
<% 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
export const loadState = (storage) => { | |
try { | |
const serializedState = localStorage.getItem(storage) | |
if (serializedState === null) | |
return undefined | |
return JSON.parse(serializedState) | |
} catch (error) { | |
return undefined | |
} | |
} |
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<link rel="https://cdnjs.cloudflare.com/ajax/libs/mocha/3.1.2/mocha.css"> | |
</head> | |
<body> |
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
`timescale 1ns / 1ns | |
module send_number_to_shift_reg(CLK, AN, DOT, A_TO_G); | |
input CLK; | |
output reg [3:0] AN; | |
output reg [6:0] A_TO_G; | |
output reg DOT; | |
parameter [31:0] REFRESH = 1024 * 256; | |
parameter [63:0] TIMEOUT = 4096 * 1024; |
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
def matrix_mult(a, b) | |
a.map do |ar| | |
ar.each_index.map do |aci| | |
b.each_with_index.reduce(0) do |sum, (br, bri)| | |
sum + ar[bri] * br[aci] | |
end | |
end | |
end | |
end |
OlderNewer