Skip to content

Instantly share code, notes, and snippets.

Avatar

Saikat Chakrabarti saikat

View GitHub Profile
View gist:e79a472d367609c5053fbb72ea79b1aa
**In 2008, as the economy was in free fall, Presidents George W. Bush and Barack Obama worked together with their secretaries of the Treasury, the chair of the Federal Reserve, and the president of the New York Federal Reserve and created one of the largest financing schemes in the history of the United States to prevent total economic meltdown. Part of this was the Troubled Asset Relief Program, the $700 billion package that Congress passed in response to the financial crisis. But the overwhelmingly greater part of this plan used the Fed to lend out somewhere between $7 trillion and $29 trillion in near-zero-interest loans directly to banks to keep them afloat. While this worked to save our banking system and avoid the worst possible disaster, the plan neglected to invest in rebuilding the real economy. As a result, Americans saw a grueling, decade-long recovery—if they saw any recovery at all.
In 2021, the Biden administration will face an even deeper and potentially longer recession, triggered by Covid-19
View gist:e7814b877be139148e56ab947e3716d9
{% set ev = event.details(1, "1/25/2017", "12/25/2017", 250, 0, 0,'miles','{title}') %}
You should come to our event, {{ev}}
When?? {{ event[0].start_date }}
Where??
{{ event[0].venue_name }}
{{ event[0].venue_addr1 }}
{{ event[0].venue_addr2 }}
{{ event[0].venue_city }}, {{ event[0].venue_state }} {{ event[0].venue_zip }}
View gist:338d6183019539520c3d044ffc8be085
import { createFragmentFromPropTypes } 'react-apollo'
import React from 'react'
function Child(props) {
return (
<div>
Name: {props.person.name} <br />
Email: {props.person.email} <br />
</div>
)
View query_7.sql
> explain analyze
select "bsd_people"."cons_id" from "bsd_person_gc_bsd_groups" as "bsd_people"
inner join "bsd_addresses" on "bsd_people"."cons_id" = "bsd_addresses"."cons_id"
inner join "zip_codes" on "zip_codes"."zip" = "bsd_addresses"."zip"
where
"zip_codes"."timezone_offset" = -7
and "bsd_addresses"."is_primary" = 'true'
limit '1';
QUERY PLAN
View gist:44ffc93a32700da515db
ground_control=> \d bsd_person_gc_bsd_groups
Table "ground_control.bsd_person_gc_bsd_groups"
Column | Type | Modifiers
-----------------+--------------------------+-----------
cons_id | bigint | not null
gc_bsd_group_id | integer | not null
modified_dt | timestamp with time zone | not null
create_dt | timestamp with time zone | not null
Indexes:
"bsd_person_gc_bsd_groups_pkey" PRIMARY KEY, btree (cons_id, gc_bsd_group_id)
View Query.sql
> explain analyze
select "bsd_people"."cons_id" from "bsd_person_gc_bsd_groups" as "bsd_people"
inner join "bsd_addresses" on "bsd_people"."cons_id" = "bsd_addresses"."cons_id"
inner join "zip_codes" on "zip_codes"."zip" = "bsd_addresses"."zip"
where
"zip_codes"."timezone_offset" = -4
and "bsd_addresses"."is_primary" = 'true'
limit '1';
QUERY PLAN
View bulkinsert.js
knex.bulkInsert = async function(table, values, {transaction}={}) {
if (values.length < 1)
return;
let valueKeys = Object.keys(values[0])
let columns = `("${valueKeys.join('","')}")`;
let valueString = values.map((valueObj) => {
let quotedValues = valueKeys.map((key) => {
let val = valueObj[key]
if (typeof val === 'object')
View Test.js
class AdminDashboard extends React.Component {
render() {
return <GroupCallViewer callId="R3JvdXBDYWxsOjFjOGUzOWVlLTAyOWYtNDIyMS05OTA3LTkxYWRmYmNkMjZiYw==" viewer={this.props.viewer}/>
}
}
export default Relay.createContainer(AdminDashboard, {
fragments: {
viewer: (variables) => Relay.QL`
fragment on Viewer {
View CallViewer.js
// GroupCallViewer.js
export class GroupCallViewer extends React.Component {
render() {
return <GroupCall groupCall={this.props.viewer.groupCall} />
}
}
export default Relay.createContainer(GroupCallViewer, {
initialVariables: {
callId: "testId"
View gist:7c049222b2f488737867
{
"name": "ground-control",
"private": true,
"description": "A tool to organize the political revolution",
"repository": "Bernie-2016/ground-control",
"version": "0.1.0",
"scripts": {
"start": "cd ./src/backend && babel-node ./server.js",
"update-schema": "babel-node ./src/backend/data/updateSchema.js"
},