Skip to content

Instantly share code, notes, and snippets.

@codegirl-007
codegirl-007 / gist:23d2856926cdebcab453
Created April 8, 2015 23:18
Mongo Search & Replace
var cursor = db.collection.find(url: /http/)
while (cursor.hasNext()) {
var x = cursor.next();
print("Before: "+x['url']);
x['url'] = x['url'].replace('http', 'https');
print("After: "+x['url']);
db.collection.update({_id : x._id}, x);
}
@codegirl-007
codegirl-007 / gist:43a710b0edf6682b0854
Created April 13, 2015 19:10
Duplicate document in Mongo
var copy = db.collection.findOne({_id : ObjectId("552c0709d07e391454f649df")},{_id:0});
for (var i = 0; i< 10; i++){
db.collection.insert(copy);
}
@codegirl-007
codegirl-007 / gist:5a4feb78e138c5579cdd
Created May 28, 2015 04:02
Separate requirejs configs from app
require.config({
deps: ['app'], //just make your app file a dependency
paths: {
//...
}
});
@codegirl-007
codegirl-007 / git-commands.sh
Last active November 6, 2015 02:59
Git Commandline basic
# create a new branch
git checkout -b branch-name
# checkout an existing branch
git checkout branch name
# pull changes from branch-a into current-branch
git checkout branch-a
git pull --rebase # get all the latest changes from branch-a
git checkout current-branch
@codegirl-007
codegirl-007 / name.js
Last active May 8, 2016 03:59
Setting up Browserify and Jasmine with NPM
exports.getName = function(name) {
return name;
}
@codegirl-007
codegirl-007 / jasmine-cheat.js
Created May 8, 2016 08:10
Jasmine cheatsheet
describe('built-in matchers', function() {
describe('toBeTruthy', function() {
it('passes if subject is true', function() {
expect(true).toBeTruthy();
expect(false).not.toBeTruthy();
});
});
describe('toBeFalsy', function() {
it('passes if subject is false', function() {
@codegirl-007
codegirl-007 / textfields.elm
Created December 28, 2020 05:44
Solution to Elm text field exercise
-- A text input for reversing text. Very useful!
--
-- Read how it works:
-- https://guide.elm-lang.org/architecture/text_fields.html
--
import Browser
import Html exposing (Html, Attribute, div, input, text)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
@codegirl-007
codegirl-007 / buttons.elm
Created December 28, 2020 05:46
Solution to Elm button exercise
module Main exposing (..)
-- Press buttons to increment and decrement a counter.
--
-- Read how it works:
-- https://guide.elm-lang.org/architecture/buttons.html
--
import Browser

Title: Tooling Troubles – The Teams Call

Cast:

  • Teej (Frustrated but good-natured software engineer, builds apps using C#)
  • Prime (Laid-back, recently promoted staff engineer, builds tooling in C#)

Setting: The entire scene happens during a Microsoft Teams call. Teej is dealing with a bug-filled tool that Prime built, and they go over some C# code and Jira tickets. Prime hilariously pushes back on fixing the bugs due to “timelines and resources,” and Teej is left comically exasperated by the situation.