Skip to content

Instantly share code, notes, and snippets.

View dariusk's full-sized avatar

Darius Kazemi dariusk

View GitHub Profile
@dariusk
dariusk / dabblet.css
Created May 9, 2013 12:58
-----------------------------------------------------------------------
/* -----------------------------------------------------------------------
Blueprint CSS Framework 1.0
http://blueprintcss.org
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the 'src' directory.
@dariusk
dariusk / dabblet.css
Created May 9, 2013 12:53
-----------------------------------------------------------------------
/* -----------------------------------------------------------------------
Blueprint CSS Framework 1.0
http://blueprintcss.org
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the 'src' directory.
@dariusk
dariusk / dabblet.css
Created May 9, 2013 12:44
-----------------------------------------------------------------------
/* -----------------------------------------------------------------------
Blueprint CSS Framework 1.0
http://blueprintcss.org
* Copyright (c) 2007-Present. See LICENSE for more info.
* See README for instructions on how to use Blueprint.
* For credits and origins, see AUTHORS.
* This is a compressed file. See the sources in the 'src' directory.
@dariusk
dariusk / index.js
Created February 21, 2013 01:28
voxel.js game
var createGame = require('voxel-engine')
function sphereWorld(x, y, z) {
// return the index of the material you want to show up
// 0 is air
if (x*x + y*y + z*z > 15*15) return 0
return 4
}
var game = createGame({
npm http 200 http://nj-npm.irisnpm.com/underscore
npm ERR! Error: No compatible version found: underscore@'>=1.4.4'
npm ERR! Valid install targets:
npm ERR! ["1.0.3","1.0.4","1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4","1.3.0","1.3.1","1.3.2","1.3.3","1.4.0","1.4.1","1.4.2","1.4.3"]
@dariusk
dariusk / gist:4979633
Last active December 13, 2015 21:48
Example of using promises in RapBot.
// word: a string representing a word
function getPartOfSpeechPromise(word) {
var word = new Wordnik.Word({
word: word,
params: {
includeSuggestions: true
}
});
@dariusk
dariusk / gist:4979533
Last active December 13, 2015 21:48
Simplified version of RapBot's getLine function
// getLine accepts two arguments:
// word: string representing a word
// pos: string of its part of speech
function getLine(word, pos) {
var result = "Oops, we didn't account for something.";
if (pos === 'adjective') {
var pre = [
@dariusk
dariusk / gist:4979315
Last active December 13, 2015 21:48
First attempt at a rhyme generator.
var Wordnik = require('wordnik-bb').init(MY_API_KEY);
var randomAdjPromise = Wordnik.getRandomWordModel({
includePartOfSpeech: "adjective"
});
randomAdjPromise.done(function(word) {
console.log("I once knew someone who was " + word.id);
var randomAdjPromise = Wordnik.getRandomWordModel({
@dariusk
dariusk / one.js
Last active December 13, 2015 19:38
Which is better, in the general case?
function foo(bar, baz) {
if (bar === "a") {
return 1;
}
else if (bar === "b" && baz === "c") {
return 2;
}
else if (bar === "d") {
return 3;
Backbone.sync = function(method, model, options) {
// we need to make sure we initialize a store, in this case
// we will just use a JS object.
var cache = window.cache = {};
// The size will be primarily used to assign ids to newly
// created models. Each time a new model is created, the size
// will be incremented.
var size = 0;