Skip to content

Instantly share code, notes, and snippets.

@jlandry
jlandry / jQuery Word Count
Created September 4, 2018 14:17
jQuery Word Count
jQuery("textarea").bind("change keyup input", function () {
var limitWord = jQuery(this).next("p").attr("style");
var regex = /\s+/gi;
var wordcount = jQuery.trim(jQuery(this).val()).replace(regex, ' ').split(' ').length;
if (wordcount <= limitWord) {
chars = jQuery(this).val().length;
} else {
var trimmed = jQuery(this).val().split(/\s+/, limitWord).join(" ");
jQuery(this).val(trimmed + " ");
wordcount = jQuery.trim(jQuery(this).val()).replace(regex, ' ').split(' ').length;
@jlandry
jlandry / keybase.md
Created January 11, 2015 00:57
keybase.md

Keybase proof

I hereby claim:

  • I am jlandry on github.
  • I am jonathanlandry (https://keybase.io/jonathanlandry) on keybase.
  • I have a public key whose fingerprint is 389B 6720 6A05 CE23 972E F414 69F4 F35B DCA1 8CC1

To claim this, I am signing this object:

#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach (9);
}
void loop()
angular.module('d3AngularApp', ['d3'])
.directive('d3Bars', ['$window', '$timeout', 'd3Service',
function($window, $timeout, d3Service) {
return {
restrict: 'A',
scope: {
data: '=',
label: '@',
onClick: '&'
},
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);