Skip to content

Instantly share code, notes, and snippets.

View stephanie-gredell's full-sized avatar

Stephanie Gredell stephanie-gredell

View GitHub Profile
@stephanie-gredell
stephanie-gredell / 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
@stephanie-gredell
stephanie-gredell / 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)
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() {
@stephanie-gredell
stephanie-gredell / name.js
Last active May 8, 2016 03:59
Setting up Browserify and Jasmine with NPM
exports.getName = function(name) {
return name;
}
@stephanie-gredell
stephanie-gredell / 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
@stephanie-gredell
stephanie-gredell / 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: {
//...
}
});
@stephanie-gredell
stephanie-gredell / 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);
}
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);
}
@stephanie-gredell
stephanie-gredell / gist:88fa2dd8a777cf82f4d9
Last active August 29, 2015 14:17
Return JSON with EBean and Play
//return a collection of items
public static Result getAssets() {
List<Asset> asset = Ebean.find(Asset.class)
.findList();
return ok(toJson(asset));
}
//or return a single item with the id being passed as a url param
public static Result getAsset(Integer id) {