Skip to content

Instantly share code, notes, and snippets.

View jhliberty's full-sized avatar
:octocat:
It's a rails kind of year

John-Henry Liberty jhliberty

:octocat:
It's a rails kind of year
View GitHub Profile
create or replace function add_on_update_trigger
(schema_name text, table_name text, column_name text)
returns void AS $body$
declare
target_table text =
quote_ident(schema_name) || '.' || quote_ident(table_name);
trig_name text =
quote_ident(
'update_' || schema_name || '_' || table_name || '_' || column_name
);
@sarfarazansari
sarfarazansari / nodejs_aws_s3_file_upload.js
Last active March 15, 2024 09:40
How to upload files to AWS S3 with NodeJS - AWS-SDK? With the help of this library you can upload any kind of file to s3. (NODEJS, AWS-SDK, S3)
/**
* we are going to upload file to s3 via node js by using
* aws-sdk - required
* busboy - required
* uuid - optional - for image renaming purpose
* with this library you can upload any kind of file to s3 via node js.
*/
const AWS = require('aws-sdk');
const UUID = require('uuid/v4');
@nickschot
nickschot / lux-postgres-search.js
Last active June 14, 2017 23:21
Lux + Postgres search middleware
/*
This middleware is to be used in the controller beforeAction hook.
You can search text, int and multi-column.
Example use in a controller:
query = ['search'];
beforeAction = [
search(MyModel, {
searchText: ['description'],
anonymous
anonymous / GAME_MASTER_v0_1.protobuf
Created July 16, 2016 16:31
Pokemon Go decoded GAME_MASTER protobuf file v0.1
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@jhliberty
jhliberty / MIDI_scales.js
Created July 4, 2016 10:03 — forked from gleitz/MIDI_scales.js
MIDI scale arrays in Javascript
var scales = {
'natural major': [0,2,4,5,7,9,11,12],
'ionian': [0,2,4,5,7,9,11,12],
'major': [0,2,4,5,7,9,11,12],
'chromatic': [0,1,2,3,4,5,6,7,8,9,10,11,12],
'spanish 8 tone': [0,1,3,4,5,6,8,10,12],
'flamenco': [0,1,3,4,5,7,8,10,12],
'symmetrical': [0,1,3,4,6,7,9,10,12],
'inverted diminished': [0,1,3,4,6,7,9,10,12],
'diminished': [0,2,3,5,6,8,9,11,12],
@CoordSpace
CoordSpace / detect_bluetooth.py
Created May 26, 2016 00:22
A simple Python script that will trigger an LED to light up when a known Bluetooth-capable device (such as your phone or fitness band) comes within sensing range.
import bluetooth, time
import Adafruit_BBIO.GPIO as GPIO
search_time = 10
led_pin = "P8_7"
# You can hardcode the desired device ID here as a string to skip the discovery stage
addr = None
print("Welcome to the Bluetooth Detection Demo! \nMake sure your desired Bluetooth-capable device is turned on and discoverable.")
import Ember from 'ember';
export default Ember.Component.extend({
theme: Ember.inject.service()
// ...
});
@zacharygolba
zacharygolba / users.js
Created March 15, 2016 19:09
Lux Controller - Example 2
import { Controller, action } from 'lux-framework';
class UsersController extends Controller {
params = [
'name',
'email',
'password'
];
@action