Skip to content

Instantly share code, notes, and snippets.

🏠
Working

Ben Polinsky benpolinsky

🏠
Working
Block or report user

Report or block benpolinsky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benpolinsky
benpolinsky / TypeScriptAssetWithErrors.ts
Last active May 28, 2019
this is a really quick way of gaining ts error reporting with parcel
View TypeScriptAssetWithErrors.ts
const Asset = require('parcel/src/Asset');
const chalk = require('chalk')
const ts = require('typescript')
const path = require('path');
const localRequire = require('parcel/src/utils/localRequire')
class TypeScriptAssetWithError extends Asset {
constructor(name, options) {
super(name, options);
this.type = 'js';
@benpolinsky
benpolinsky / index.js
Created Aug 19, 2017
requirebin sketch
View index.js
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
alert('hello');
View change_maker.rb
# Not thoroughly tested, but this seems to solve the problem recursively
class ChangeMaker
# in cents, so the below ints are equal to
# penny, nickle, dime, quarter, dollar, five, ten, twenty, fifty, a hundred
DENOMINATIONS = [1, 5, 10, 25, 100, 500, 1000, 2000, 5000, 10000]
def initialize(cost, tendered)
@benpolinsky
benpolinsky / gist:67e776a5ab9a7062b777
Last active Aug 29, 2015
1st refactor of devise identity management
View gist:67e776a5ab9a7062b777
# refactoring of Kam Low's ::find_for_oauth
# Thanks so much for this article about managing multiple providers with omniauth
# Check it out: http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/
def self.find_for_oauth(auth, signed_in_resource = nil)
identity = Identity.find_for_oauth(auth)
user = signed_in_resource ? signed_in_resource : identity.user
user = find_for_oauth_email(auth) || create_for_oauth(auth) if user.nil?
update_identity(identity, user)
user
@benpolinsky
benpolinsky / gist:84cba7b845c8e7dd6b54
Created Feb 23, 2015
Quick and Dirty Rails Style HTML Tag Helpers
View gist:84cba7b845c8e7dd6b54
<?php
/*
*
* link_to(url, text, options)
* url and text are strings, options is an object with any additional attributes you might want on a link
* Simple. Rustic, yeah? | Use it like this:
* link_to('http://www.google.com', "Google", object ["id" => "user_link_132930482", "class" => "my_link", "alt" => "alt-text"]);
*
*/
You can’t perform that action at this time.