Skip to content

Instantly share code, notes, and snippets.

@Shiggiddie
Shiggiddie / beer_me_learnings
Created January 15, 2015 02:41
beer_me learnings
After porting beer_me to a mean.js app, I kept seeing "exports": e.g. "exports.foo = function() {console.log('hi');}"
I assumed this had something to do with the way the functions were exposed elsewhere in a mean.js app's codebase.
This assumption was fairly correct, and confirmed after reading: http://www.sitepoint.com/understanding-module-exports-exports-node-js/
I do not understand this line: https://github.com/cpww/beer_me/blob/master/app/controllers/users.server.controller.js#L11
Where does the ".extend" method come from?
So the var "_" is assined the module.exports object from "lodash".
Therefore "_.extend" is accessing the "extend" function from within the "lodash" module.
@Shiggiddie
Shiggiddie / gist:643e7153605354b84686
Last active December 16, 2015 02:59
Ruby/Rails HW: get/post routes, passing parameters into .erb templates, .erb if/else template logic
# 1) Make necessary modifications to a rails project such that an HTML response of "<h1>Hello World</h1>"
# is returned when hitting the path "/hello_world/index" with a GET request
# 2) Devise a shell utility "curl" command that makes a GET request of the path constructed in #1
# 3) Make necessary modifications to the rails project such that an HTML response of "<h1>Hello POST world</h1>"
# is returned when hitting the path "/hello_world/index" with a POST request, do not remove any code created in #1
# 4) Devise a shell utility "curl" command that makes a POST request of the path constructed in #2
@Shiggiddie
Shiggiddie / 04052015_quiz
Last active August 29, 2015 14:20
Bad array function use
// Problem: given an array of elements, create the array function to turn that array into
// a string that will represent an html table containing the array elements, one element per row,
// with each element appended with "foo"
// E.g. The following array...
var arr = ["hi", "bye", "todo", "fly"];
// ...becomes:
// <html>
// <body>
// <table>
@Shiggiddie
Shiggiddie / reddit_comment.js
Last active July 29, 2016 16:30
Reddit Comment Posting using only request-promise and session cookies
/*
* The purpose of this excercise was to understand how to preserve a session
* using only request-promise (https://www.npmjs.com/package/request-promise)
*
* USAGE:
*
* Grab dependencies:
* $ npm --save request
* $ npm --save request-promise
*
@Shiggiddie
Shiggiddie / index.js
Created October 7, 2016 14:32
Cooking with GAS - Subverting User-permission Authorization in Spreadsheet onEdit function
// Ideally one would get user information from onEdit using onEdit's event's .user attribute,
// however GAS does not give authorization to do so for the onEdit function (without some minor caveats).
// The following subverts this slightly by allowing the user to include their own user information that is
// then stored on the user's properties for the file/script.
function onEdit(e) {
var user = PropertiesService.getUserProperties().getProperty('user');
if (!user) {
var ui = SpreadsheetApp.getUi();
while (!user) {
using System;
using Xamarin.Forms;
using System.Windows.Input;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.ComponentModel;
using System.Threading.Tasks;
[assembly:
InternalsVisibleTo ("TwinTechsLib.iOS"),
### Keybase proof
I hereby claim:
* I am shiggiddie on github.
* I am shiggiddie (https://keybase.io/shiggiddie) on keybase.
* I have a public key ASAUMzmuLKaZLU7s-KvZ8pWfmMUxiTNkRaxNif-k-dkg0Ao
To claim this, I am signing this object: