Note: Please check this blog post for more details on these functions.
Sort a SQL query with id
and parentid
so that
the rows have the correct order of the tree.
Parameters:
q
(Array): A query result (see example below)
// React JSON Editor wrapper | |
// JSON Editor by Jos de Jong - https://github.com/josdejong/jsoneditor | |
// Based on post by Hassan Khan - https://github.com/josdejong/jsoneditor/issues/274#issuecomment-263986071 | |
// Wrapper By Ian Grossberg - https://gist.github.com/yoiang/6f82874f4fd8fc1a37631dc9cad27172 | |
import React, { Component, PropTypes } from 'react'; | |
import JSONEditor from 'jsoneditor'; | |
import cloneDeep from 'lodash.clonedeep'; | |
import isEqual from 'lodash.isequal'; |
require 'active_support/core_ext/string/filters' | |
module PostgresTimestampDefaults | |
def add_timestamp_defaults(table_name) | |
add_default_now(table_name, :created_at) | |
add_default_now(table_name, :updated_at) | |
add_updated_at_trigger(table_name) | |
end | |
def add_default_now(table_name, column_name) |
Note: Please check this blog post for more details on these functions.
Sort a SQL query with id
and parentid
so that
the rows have the correct order of the tree.
Parameters:
q
(Array): A query result (see example below)# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things". | |
"1", "Something", "0.50", "2013-05-05 10:00:00" | |
"2", "Another thing", "1.50", "2013-06-05 10:30:00" | |
# Now you want to import it, go to the command line and type: | |
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;" | |
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this: |
In the default React Native app scaffolding you have to edit AppDelegate.m
to change where it loads the code if you want to test on your device. I use the following snippet to detect if it's being compiled for Debug or Production and for the Simulator or a device. For Production it uses a copy of the code included in the bundle, for Debug on the simualtor it loads from a server on localhost and for Debug on a device it loads from a server on a given IP address.
NOTE: You need to edit YOUR-IP-HERE and change it to the IP to load the code from when in Debug mode on a device. You could use a service like ngrok to make this work from anywhere.
NSURL *jsCodeLocation;
// Loading JavaScript code
#if DEBUG
// For Debug build load from development server. Start the server from the repository root:
A collection of articles by AngularJS veterans, sometimes even core committers, that explain in detail what's wrong with Angular 1.x, how Angular 2 isn't the future, and why you should avoid the entire thing at all costs unless you want to spend the next few years in hell.
Reason for this: I'm getting tired of having to explain to everyone, chief of which all the indiscriminate Google Kool-Aid™ drinkers, why I have never believed in Angular, why I think it'll publicly fail pretty soon now (a couple years), and why it's a dead end IMO. This gist serves as a quick target I can point people to in order not to have to parrot / compile the core of the articles below everytime. Their compounded reading pretty much captures 99% of my view on the topic.
This page is accessible through http://bit.ly/angular-just-say-no and http://bit.ly/angularjustsayno, btw.
const strategy = 'keycloak' | |
export default function ({ app }) { | |
const { $axios, $auth } = app | |
if (!$auth.loggedIn || !$auth.strategies[strategy]) | |
return | |
const options = $auth.strategies.keycloak.options |
function interval(duration, fn){ | |
var _this = this | |
this.baseline = undefined | |
this.run = function(){ | |
if(_this.baseline === undefined){ | |
_this.baseline = new Date().getTime() | |
} | |
fn() | |
var end = new Date().getTime() |
function go() { | |
var userId = prompt('Username?', 'Guest'); | |
checkIfUserExists(userId); | |
} | |
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users'; | |
function userExistsCallback(userId, exists) { | |
if (exists) { | |
alert('user ' + userId + ' exists!'); |
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.