Skip to content

Instantly share code, notes, and snippets.

View failpunk's full-sized avatar

Justin Vencel failpunk

View GitHub Profile
{
"metrics":{
"participants":[]
}
}
@failpunk
failpunk / fluid_calculator.js
Created March 19, 2019 21:20
This is a simple javascript test exercise.
class FluidCalc {
constructor() {
// Array of operation objects
this.operations = [];
// Stores the first number in the chain
this.first_number = null;
// The latest operation in the chain
this.current_operation = null;
@failpunk
failpunk / LtoE.js
Last active February 15, 2017 20:45
Lodash to Javascript 2016+
// https://bitbucket.org/repomode/bartleby-frontend/pull-requests/6/merging-dev-to-master-for-push-to-staging/diff#Lapp/routes/category/category.model.jsT144
// Lodash assign (just use Object.assign).
// Lodash uses Object.assign behind the scenes anyway.
Object.assign(obj, {}, {});
// https://bitbucket.org/repomode/bartleby-frontend/src/3ee2cc7aca1a49ab3baa311173780da07b5a6d9f/app/routes/category/category.model.js?fileviewer=file-view-default#category.model.js-38
// Lodash.get (just use the or operator)
let temp = {a: 'a',b: 'b',c: 'c'};
temp.a || ‘z’;
@failpunk
failpunk / my.component.js
Last active July 27, 2016 19:49
Testing angular components without using module mock
let Component = {
template: `
<div>
<h1>{{$ctrl.title}}</h1>
<form ng-if="!$ctrl.successs">
form data...
</form>
<div
@failpunk
failpunk / gist:c69ec07e8ca78a3f29ae
Created July 12, 2014 00:27
MySQL update from another table
UPDATE sub_campaign
SET sub_campaign.name = (
SELECT targeting_type.name
FROM targeting_type
WHERE targeting_type.id = sub_campaign.targeting_type_id
)
WHERE sub_campaign.name IS NULL;
@failpunk
failpunk / .gitconfig
Created March 11, 2014 22:00 — forked from orj/.gitconfig
[merge]
keepBackup = false
tool = custom
[mergetool "custom"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$LOCAL" "$PWD/$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
@failpunk
failpunk / cubs_draft.php
Created January 2, 2014 20:45
This script gives you the current MLB draft position of the Chicago Cubs.
<?php
class CubsDraft
{
public $_stats = [];
protected $_table = null;
public function __construct()
{
@failpunk
failpunk / highwire
Created August 26, 2013 22:16
A Simple little library for interaction with Highcharts
/*
* Simple Library to interaction with Highcharts
*
*/
var Highwire = function () {
var chart
, graph_container;
<?php
/*
* ROUTING
*/
$app->get('/archive/{year}/{month}', function($month, $year) {
// ...
})
<?php
namespace Silex\Provider;
use Silex\Application;
use Silex\SilexEvents;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;