Skip to content

Instantly share code, notes, and snippets.

View rlodina's full-sized avatar

Radu Lodina rlodina

  • Baia Mare, Romania
View GitHub Profile
@rlodina
rlodina / console.js
Created December 21, 2019 15:22 — forked from Harshmakadia/console.js
Mastering JS console like a Pro
// time and time end
console.time("This");
let total = 0;
for (let j = 0; j < 10000; j++) {
total += j
}
console.log("Result", total);
console.timeEnd("This");
// Memory
@rlodina
rlodina / PostgresMiddleware.js
Created May 7, 2018 06:53
Node.js Postgres Redis query caching with variable expiration
/**
* PostgresMiddleware.js
*
* Handles postgres queries and caching to redis
* see README for usage
*
*/
var pg = require('pg'),
crypto = require('crypto'),
@rlodina
rlodina / nodejs-cheatsheet.js
Created February 22, 2018 17:10 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@rlodina
rlodina / index.js
Created February 22, 2018 17:05 — forked from zkat/index.js
npx is cool
#!/usr/bin/env node
console.log('yay gist')
@rlodina
rlodina / benchmark.sh
Created November 8, 2016 05:42 — forked from peterjmit/benchmark.sh
Bash Benchmark Script (using time)
#!/bin/bash
# REQUIRES SUDO
# Benchmark runner
repeats=20
output_file='benchmark_results.csv'
command_to_run='echo 1'
run_tests() {
# --------------------------------------------------------------------------
@rlodina
rlodina / README.md
Last active August 29, 2015 14:18 — forked from mbostock/.block
  1. If you haven’t already: brew install ffmpeg gifsicle imagemagick.
  2. Open QuickTime Player.
  3. File > New Screen Recording.
  4. Record.
  5. Save as recording.mov.
  6. ffmpeg -i recording.mov -r 24 recording-%03d.png
  7. convert recording-001.png palette.gif Note: you may need to pick a different frame for better results!
  8. convert -dither none -remap palette.gif recording-*.png recording-uncompressed.gif
  9. gifsicle --optimize=3 --delay=4 < recording-uncompressed.gif > recording.gif
@rlodina
rlodina / form.js
Created March 15, 2014 16:37 — forked from bakura10/form.js
'use strict';
/**
* Basic form
*/
module.exports = App.ValidatableFormComponent = Ember.Component.extend({
/**
* @type {String}
*/
tagName: 'form',

Hai!

This baby registers an Ember Handlebars helper using @aterrien's awesome jQuery-Knob

Usage:

{{radial-progress progress=myProgress}}

and vuala!!! you've got yourself a knob. options:

// ember-timeago.js
// Using momentjs to provide neat helper for fromNow() calls.
App.Clock = Em.Object.create({
seconds: 0,
minutes: 0,
hours: 0,
init: function() {
this.tick();
},
@rlodina
rlodina / auth.js
Created February 18, 2014 19:37 — forked from raytiley/auth.js
var dbRef = new Firebase("https://YOUR-FIREBASE.firebaseio.com/");
export default Ember.Controller.extend({
/**
@property currentUser
@type {User}
@default null
*/
currentUser: null,