Skip to content

Instantly share code, notes, and snippets.

View atticoos's full-sized avatar
🧑‍💻
building Rally

Atticus White atticoos

🧑‍💻
building Rally
View GitHub Profile
function chunk (list, size) {
return list.reduce(function (chunkedList, item) {
// the most recent chunk
var currentChunk = chunkedList[chunkedList.length - 1];
if (currentChunk.length === size) {
// the chunk has reached the maximum size
// create a new empty chunk and add it to the chunked list
currentChunk = [];
const orientationSelector = state => state.orientation;
// memoized selector will only return a new OrientationHelper if the `orientation` changes
const orientationHelperSelector = createSelector(
orientationSelector,
(orientation) => new OrientationHelper(orientation)
);
class OrientationHelper {
constructor(orientation) {
"use strict";
angular.module("app.animations", ["ngAnimate"]).animation(".slide-animation", function() {
return {
addClass: function(a, b, c) {
var d = a.scope();
if ("active" == b) {
a.addClass("active");
var e = a.parent().width();
"right" !== d.banner.direction && (e = -e), a.css({
left: e
react-tools file: /Users/ajwhite/Desktop/react-native/node_modules/react-tools/node_modules/commoner/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js
react-tools file: /Users/ajwhite/Desktop/react-native/node_modules/react-tools/node_modules/commoner/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/basic.js
react-tools file: /Users/ajwhite/Desktop/react-native/node_modules/react-tools/node_modules/commoner/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js
react-tools file: /Users/ajwhite/Desktop/react-native/node_modules/react-tools/node_modules/commoner/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js
react-tools file: /Users/ajwhite/Desktop/react-native/node_modules/react-tools/node_modules/commoner/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js
react-tools file: /Users/ajwhite/Desktop/react-native/node_modules/react-tools/node_modules/commoner/node_modules/glob
react-tools file: /Users/ajwhite/Development/Labs/react-native/node_modules/react-tools/node_modules/commoner/node_modules/mkdirp/bin/cmd.js
react-tools file: /Users/ajwhite/Development/Labs/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/esprima-fb/test/compat.js
react-tools file: /Users/ajwhite/Development/Labs/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/esprima-fb/test/reflect.js
react-tools file: /Users/ajwhite/Development/Labs/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/esprima-fb/test/run.js
react-tools file: /Users/ajwhite/Development/Labs/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/esprima-fb/test/runner.js
react-tools file: /Users/ajwhite/Development/Labs/react-native/node_modules/react-tools/node_modules/commoner/node_modules/recast/node_modules/esprima-fb/test/test.js
react-tools file: /Users/ajwhite/Devel
'use strict';
describe('memory test', function () {
beforeEach(inject());
describe('testing', function () {
it ('should grow in memory', function (done) {
setTimeout(function () {
for (var i = 1; i < 100; i++) {
var result = Math.pow(i, 2);
expect(result).to.be.eql(Math.pow(i, 2));
@atticoos
atticoos / client.js
Created May 31, 2015 02:44
client-server node example
// Note - examples are strictly examples, the patterns used are generally seen as antipatterns
// where a data-binding framework would be much more appropriate for rendering your dynamic views
// suppose you have some function to.. idk, get the user's name and to update the view
function getSomeDataAndUpdateTheView () {
return $http.get('/path/to/user/endpoint').then(function (user) {
$('h1').text('Welcome ' + user.name);
})
}
@atticoos
atticoos / robin.java
Last active August 29, 2015 14:18
Making a robin network request in Java with OkHTTP
private final OkHttpClient client = new OkHttpClient();
public void run () throw Exception {
// prepare the request
Request request = new Request.Builder()
.url("https://api.robinpowered.com/v1.0/spaces/SPACE_ID/presence") // this is the endpoint to get who's in the space
.header("Authorization", "Access-Token YOUR_ACCESS_TOKEN") // this lets robin know who you are
.build();
// execute the request
@atticoos
atticoos / gist:42e972456e46b7095f9f
Last active August 29, 2015 14:13
Hex opacity values
  • 100% — FF
  • 95% — F2
  • 90% — E6
  • 85% — D9
  • 80% — CC
  • 75% — BF
  • 70% — B3
  • 65% — A6
  • 60% — 99
  • 55% — 8C
@atticoos
atticoos / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console