http://www.codewars.com/kata/unpacking-arguments
http://www.codewars.com/kata/for-the-sake-of-argument
// write nLengthSubstrings(string, n) | |
var nLengthSubstrings = Assessment.nLengthSubstrings = function(str, num){ | |
var result = []; | |
if(str.length < num) { return result; } | |
else { | |
for(var i=0; i+num <= str.length; i++){ | |
var x = i + num; | |
var sub= str.substring(i, x); | |
result.push(sub); | |
} |
(function(){ | |
var inherits = function(subClass, superClass){ | |
subClass.prototype = Object.create(superClass.prototype); | |
subClass.prototype.constructor = subClass; | |
} | |
var inherits2 = function (ChildClass, ParentClass) { | |
function Surrogate () {} | |
Surrogate.prototype = ParentClass.prototype; | |
ChildClass.prototype = new Surrogate(); |
from app import db | |
from app.models import User | |
from flask_restful import Resource, fields, marshal, reqparse | |
user_field = { | |
'id' : fields.Integer, | |
'username' : fields.String, | |
'email' : fields.String | |
} |
//Create a new Graph Object | |
FB.api( | |
'me/objects/video.movie', | |
'post', { | |
'object': { | |
'title': 'Sample Movie', | |
'type': 'video.movie', | |
'image': 'http://stuffpoint.com/cats/image/41633-cats-cute-cat.jpg', | |
'url': 'http://localhost:9000', | |
'description': 'Example Description Here', |
http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742
Legendary book, a must-read for any Javascript programmer at least once. Goes into the basics of Javascript with the assumption that the reader is an experienced programmer already, coming from another language or already understands a fair bit about Javascript itself. Very good review of basics and more advanced concepts (like scope/closure, functions as first class objects, etc).
import React from "react"; | |
import { render } from "react-dom"; | |
const ParentComponent = React.createClass({ | |
getDefaultProps: function() { | |
console.log("ParentComponent - getDefaultProps"); | |
}, | |
getInitialState: function() { | |
console.log("ParentComponent - getInitialState"); | |
return { text: "" }; |
function vacancies(arr) { | |
var vacancies = []; | |
for (var i=0; i < arr.length; i++) { | |
if (arr[i] === "vacancy") { | |
vacancies.push(arr[i]); | |
} | |
} | |
if (vacancies.length === 0) { | |
return "no vacancies"; | |
} |
#Abacus script | |
#Enter a value and have it printed out in abacus form | |
from numFinder import * | |
from rep import * | |
# checks if value is between 1 and 1 billion. | |
def valid_Num(num): | |
if num <= 1000000000 and num >= 0: | |
return True | |
else: |
//Installed node modules: jquery underscore request express jade shelljs passport http sys lodash async mocha chai sinon sinon-chai moment connect validator restify ejs ws co when helmet wrench brain mustache should backbone forever debug | |
var _ = require('underscore'); | |
var num = "the number: "; | |
var num2 = "10"; | |
// console.log(num + num2) | |
var num3 = 42; //string //integer |