View subclass.coffee
class Class | |
bar: -> console.log @a | |
class SubClass extends Class | |
inst = new SubClass | |
inst.a = 10 | |
inst.bar() # => 10 |
View body.pug
body.hold-transition.skin-green.sidebar-mini | |
.wrapper | |
// Шапка | |
header.main-header | |
// Логотип | |
a.logo(href='#') | |
span.logo-mini | |
b Н | |
| К | |
span.logo-lg |
View sort.cpp
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <iterator> | |
int main(void) { | |
std::ios::sync_with_stdio(false); | |
int len; | |
std::cin >> len; | |
std::vector<int> vec(201); |
View sort_ansi.c
#include <stdlib.h> | |
#include <stdio.h> | |
int main(void) { | |
int len; | |
scanf("%d", &len); | |
/* malloc array of ints */ | |
int* arr = (int*)malloc(201 * sizeof(int)); | |
for (int t, i = 0; i < len; i++) { |
View db_promise.js
function someHander(req, res, next) { | |
db.any('select * from users') | |
.then((data, cb) => { | |
let red = [] | |
data.forEach(row => { | |
red[i] = row.username | |
}) | |
res.json({ | |
red | |
}) |
View babel.preset.js
const preset = buildPreset() | |
Object.defineProperty(preset, "buildPreset", { | |
configurable: true, | |
writable: true, | |
enumerable: false, | |
value: buildPreset | |
}) | |
module.exports = preset | |
function buildPreset(opts = {}) { |
View Chat.js
var http = require("http"); | |
var msgs = []; // All messages array | |
var subscribers = []; // All subscribers array | |
var PORT = process.env.PORT || 8080; | |
// Create HTTP server | |
var server = http.createServer(function(req, res) { | |
// Small router | |
switch(req.url) { | |
case "/": |
View ui-height.js
var atBottom = true | |
var scrollTopInitial = -1 | |
$(scrollableWrap).on('scroll', function (e) { | |
if (!element.is(':visible') || | |
$(scrollableWrap).hasClass('im_history_to_bottom') || | |
curAnimation) { | |
return | |
} | |
var st = scrollableWrap.scrollTop | |
atBottom = st >= scrollableWrap.scrollHeight - scrollableWrap.clientHeight |
View Memoization.jsx
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
class Memoization extends React.Component { | |
lastInput = null; | |
result = null; | |
render() { | |
const { equals, input, compute, children } = this.props; | |
View pwgen.sh
# How to use: sh pwgen.sh <password length, default 9> | |
_LENGTH=9 | |
if test x"$@" != x | |
then _LENGTH="$@" | |
fi | |
cat /dev/urandom |\ | |
tr -dc 'A-Za-z0-9' |\ | |
fold -w $_LENGTH |\ | |
#-w 20 |\ |
OlderNewer