This file contains 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
function calcFletcherSum(data) { | |
var length = data.length, i = 0, sum1 = 0xFF, sum2 = 0xFF; | |
while (length) { | |
var tlen = length > 21 ? 21 : length; | |
length -= tlen; | |
do { | |
var ch = data.charCodeAt(i++); | |
if (ch > 255) { | |
var ch2 = ch >> 8; | |
ch &= 0xFF; |
This file contains 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
db.CommonHeaderRule.aggregate({$group: {_id: "$Titles", count: {$sum:1}}}, {$sort: {count:-1}}) | |
db.AssortmentHeaderRule.count() | |
db.AssortmentHeaderRule.distinct("Title") |
This file contains 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
using System; | |
using Ksnsi.Services.Validation.ColValidators; | |
using NUnit.Framework; | |
namespace Ksnsi.Services.Tests | |
{ | |
[TestFixture] | |
internal class ColValidatorNumericTest | |
{ | |
private IColValidator _validator; |
This file contains 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
Sequelize = require 'sequelize' | |
sequelize = Sequelize.sequelize | |
sequelize.define 'article', | |
title: | |
type: Sequelize.STRING | |
html: | |
type: Sequelize.STRING |
This file contains 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
fib = (n) -> | |
# Do it the ridiculous, but not most ridiculous, way. For better, | |
# see http://nayuki.eigenstate.org/page/fast-fibonacci-algorithms | |
a = 0 | |
b = 1 | |
i = 0 | |
while i < n | |
c = a + b |
This file contains 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
amqp = require("amqplib") | |
basename = require("path").basename | |
when_ = require("when") | |
defer = when_.defer | |
uuid = require("node-uuid") | |
# I've departed from the form of the original RPC tutorial, which | |
# needlessly introduces a class definition, and doesn't even | |
# parameterise the request. | |
n = undefined |
This file contains 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
.not-selectable { | |
-webkit-touch-callout: none; | |
-webkit-user-select: none; | |
-khtml-user-select: none; | |
-moz-user-select: none; | |
-ms-user-select: none; | |
user-select: none; | |
} |
This file contains 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
$(".resize-handle").on "mousedown", (e)-> | |
left = $(this).prev('.layout-col') | |
right = $(this).next('.layout-col') | |
windowWidth = $(window).width() | |
oldLeft = left.width()/windowWidth*100; | |
oldRight = right.width()/windowWidth*100; | |
oldX = e.clientX | |
console.info 'start', oldLeft, oldRight | |
onMouseMove = (e) -> | |
offset = oldX - e.clientX |
This file contains 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
package main | |
import ( | |
"testing" | |
) | |
func TestAdd(t *testing.T) { | |
if add(2,3,4,5,6) != 20 { | |
t.Error("Bad test") |
This file contains 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
package main | |
import "fmt" | |
func add(a ...int) int { | |
sum := 0 | |
for _, num := range a { | |
sum += num | |
} | |
return sum |