Skip to content

Instantly share code, notes, and snippets.

View nonsensecreativity's full-sized avatar

Hermanto Lim nonsensecreativity

View GitHub Profile
SELECT
(
IF (
(
SELECT COUNT(*)
FROM `people_person_contacts`
WHERE `from_person_id` = 12895 AND `to_person_id` = `people_person`.`id`
),
1,
IF (
SELECT DISTINCT
`people_person`.`id`,
`people_person`.`date_created`,
`people_person`.`date_modified`,
`people_person`.`access`,
`people_person`.`thumbnail`,
`people_person`.`description`,
`people_person`.`short_description`,
`people_person`.`title`,
`people_person`.`first_name`,
CREATE TABLE IF NOT EXISTS cb_organizations (
company_name varchar(65535),
domain varchar(65535),
country_code varchar(65535),
state_code varchar(65535),
region varchar(65535),
city varchar(65535),
status varchar(65535),
short_description varchar(65535),
category_list varchar(65535),
@nonsensecreativity
nonsensecreativity / Data Verify Test
Created April 20, 2017 05:24 — forked from hkouns/Data Verify Test
Testing handlebars solution to DataVerification Report
import datetime
D1 = datetime.date.today()
sqlscript = '''
SELECT
p.PeopleId,
p.FamilyId,
p.Name2,
p.FirstName,
p.PreferredName,
-- MySQL dump 10.13 Distrib 5.5.49, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: ggrcdev
-- ------------------------------------------------------
-- Server version 5.5.49-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
; (function (global, define) { define('module-name', function (require, exports, module) {
// CommonJS style code here
/*!
* UMD/AMD/Global context Module Loader wrapper
* based off https://gist.github.com/tejacques/202a8f2d198ddd54a409
*
* This wrapper will try to use a module loader with the
* following priority:
*
let wrappable = {
'object': true,
'function': true
};
let autowrapSymbol = '@@autowrap';
function wrap(fn) {
console.log('wrapping function call');
let wrapped = function() {
/**
* I'd like to have a router with semantics that work like this
* Pros:
* - Named routes
* - Type Safe routing (with TypeScript)
* - Links are not strings so refactoring/changing them is trivial
* - Relative links are possible
*
* Cons:
* - Verbose links
@nonsensecreativity
nonsensecreativity / HOCBaseRender.tsx
Created June 12, 2017 10:00 — forked from tejacques/HOCBaseRender.tsx
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
function identity(x) {
return x;
}
function fp<T1, T2> (
transform: (x: T1) => T2
): (x: T1) => T2;
function fp<T1, T2, T3> (
transform1: (x: T1) => T2,