Skip to content

Instantly share code, notes, and snippets.

View bishopZ's full-sized avatar

Bishop Zareh bishopZ

View GitHub Profile
@tmaclean-LV
tmaclean-LV / index.js
Last active September 23, 2021 14:16
Control user access to models in Keystone.js
// Place this with the other middleware inclusion in routes/index.js
keystone.pre('admin', middleware.enforcePermissions);
@bishopZ
bishopZ / 3D Studio Notes
Last active November 29, 2016 14:50
3D Studio Notes
// Books
https://www.amazon.com/How-Cheat-3ds-Max-2015-ebook/dp/B00ZUU4AEC/
// Resources, Tutorials
http://area.autodesk.com/
https://www.youtube.com/user/3dsMaxHowTos
http://www.lynda.com/3ds-Max-training-tutorials/138-0.html
require File.join(File.dirname(__FILE__), '../../lib/account')
Given(/^I have \$(\d+) in my account$/) do |starting_balance|
@account = Account.new(starting_balance)
end
When(/^I request my account balance$/) do
@retrieved_balance = @account.balance
end
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@nijikokun
nijikokun / base64-utf8.module.js
Last active February 11, 2024 23:16
Javascript Base64 UTF8 for the Browser / Server. Base64 UTF-8 Encoding and Decoding Libraries / Modules for AMD, CommonJS, Nodejs and Browsers. Cross-browser compatible.
// UTF8 Module
//
// Cleaner and modularized utf-8 encoding and decoding library for javascript.
//
// copyright: MIT
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
(function (name, definition, context, dependencies) {
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); }
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); }
else { context[name] = definition.apply(context); }
// created by greg reimer ("gregreimer" at gmail) http://obadger.com/
function createHistogram(rFunc) {
var arr = [];
var size = 30;
for (var i=0; i<size; i++){
arr[i] = 0;
}
for (var i=0; i<1000000; i++){
arr[Math.floor(rFunc() * size)]++;
@bbrewer97202
bbrewer97202 / heroku-htaccess.md
Created August 10, 2012 18:20
Simple htaccess authentication on Heroku with cedar/php

Create an .htaccess file in the webroot:

AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user

Create a .htpasswd file:

htpasswd -c /app/www/.htpasswd [username]

@SlexAxton
SlexAxton / safeForEach.js
Created April 23, 2012 22:57
Safe forEach in JavaScript
Array.prototype.safeForEach = function ( fn ) {
var len = this.length;
for ( var cur = 0, cur < len; ++cur ) {
for ( var i = 0; i < len; ++i ) {
if ( this.hasOwnProperty[ i ] ) {
if ( i === cur ) {
fn && fn( this[ i ], i, this );
}
}
}
@kylerush
kylerush / build-html.js
Last active October 25, 2018 13:25
Detailed Flickr photo wall tutorial
function(data){
//loop through the results with the following function
$.each(data.photoset.photo, function(i,item){
//build the url of the photo in order to link to it
var photoURL = 'http://farm' + item.farm + '.static.flickr.com/' + item.server + '/' + item.id + '_' + item.secret + '_m.jpg'
//turn the photo id into a variable
var photoID = item.id;
@JamieMason
JamieMason / average.js
Created July 28, 2011 09:29
Using underscore.js, return the average value from an array of Numbers.
function average (arr)
{
return _.reduce(arr, function(memo, num)
{
return memo + num;
}, 0) / arr.length;
}