Skip to content

Instantly share code, notes, and snippets.

View traumverloren's full-sized avatar
🐢

Stephanie traumverloren

🐢
View GitHub Profile
@traumverloren
traumverloren / peptalk.txt
Last active August 29, 2015 14:15
Pep talk
I know you've done everything possible to get to where you are in Ruby and in Dutch in a really short timeframe.
And no matter what anyone else says,
and no matter how anyone treats you,
you can know that you are putting the effort in,
and you've accomplished so much.
I'm more and more impressed every day.
Honestly, you've given me renewed drive to improve my development skills.
@traumverloren
traumverloren / rename_mongoid_collection.rb
Created January 25, 2016 12:17
How to rename a mongoid collection in 4.0.2
$ Mongoid::VERSION
=> "4.0.2"
$ Mongoid::Sessions.default[:delivery_addresses].rename(:banned_addresses)
=> {"ok"=>1.0}
@traumverloren
traumverloren / find_duplicates.rb
Created February 2, 2016 09:05
Find duplicates in MongoDB collection using Aggregate in Rails Console
results = Merchant.collection.aggregate([
{ "$group" => {
_id: { "confirmation_token" => "$confirmation_token"},
recordIds: {"$addToSet" => "$_id" },
count: { "$sum" => 1 }
}},
{ "$match" => {
count: { "$gt" => 1 }
}}
])
@traumverloren
traumverloren / webpack.config.js
Created February 7, 2016 19:49 — forked from learncodeacademy/webpack.config.js
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@traumverloren
traumverloren / how_to_curl.md
Created March 14, 2016 12:43
example curl call in terminal format
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("ParentComponent - getDefaultProps");
},
getInitialState: function() {
console.log("ParentComponent - getInitialState");
return { text: "" };

import/export: tbd

object destructuring: tbd

const/let/var:

const/let are block scoped (meaning anywhere we have an opening and closing curly brace we're creating a new scope).

It's generally agreed upon that block scope is a better paradigm than function scope which is why organizations like Mozilla have been primarily using let internally for years. Now that brings us to const. Everything let has, const also has. The only difference is that when you create a variable with const, that variable can't be re-assigned a new reference. Notice I didn't say that variable is immutable.

@traumverloren
traumverloren / docker-tips.md
Last active June 22, 2016 14:10
Getting up and running with Docker
@traumverloren
traumverloren / 0_reuse_code.js
Created July 4, 2016 12:05
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
@traumverloren
traumverloren / react_initial_steps.md
Last active July 9, 2016 09:02
Setup a new React project & Hello world component. Using ES6, webpack, babel (include stage3 for await/async)

Package.json

  • Create package.json file:
$ npm init

Setup Dependencies

  • Install initial dependencies:
$ npm install --save react react-dom && npm install --save-dev html-webpack-plugin webpack webpack-dev-server babel-{core,loader} babel-preset-react