Skip to content

Instantly share code, notes, and snippets.

View jhbrunokim's full-sized avatar
🚀
Ready to Move to Mars

brunoKim jhbrunokim

🚀
Ready to Move to Mars
View GitHub Profile
@ataube
ataube / transaction.js
Created August 14, 2016 20:25
Loopback async/await transaction example
const Transaction = require('loopback-datasource-juggler');
const update = async (ids, delta) => {
const result = [];
const tx = await models.MyModel.beginTransaction({ isolationLevel: Transaction.READ_COMMITTED });
try {
for (const id of ids) {
const entity = await updateById(id, delta, { transaction: tx });
result.push(entity);
}
#include <boost/thread.hpp>
#include <iostream>
using namespace std;
void ThreadFunction()
{
int counter = 0;
for(;;)
@arisetyo
arisetyo / index.html
Created July 12, 2013 16:37
Dynamic Real-time Chart Using Chart.js, Socket.io, and Knockout.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Galenic">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/knockout-2.1.0.js"></script>
<script src="js/Chart.js"></script>
<link rel="stylesheet" href="pure-min.css">
@tsvetomir
tsvetomir / l2e_dategrouping.cs
Created December 17, 2012 11:50
Date grouping with LINQ to Entities
var groupedData =
from s in db.Intraday
where s.Date >= dateFrom && s.Date <= dateTo
group s by new
{
Year = s.Date.Year,
Month = baseUnit >= BaseUnit.Months ? s.Date.Month : 1,
Day = baseUnit >= BaseUnit.Weeks ? s.Date.Day : 1,
Hour = baseUnit >= BaseUnit.Hours ? s.Date.Hour : 0,
Minute = baseUnit >= BaseUnit.Minutes ? s.Date.Minute : 0
@0xF1o
0xF1o / gist:4179759
Created December 1, 2012 00:30
win32 GetLastInputInfo C# example
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace GetLastUserInput
{
public class GetLastUserInput
{
private struct LASTINPUTINFO
{
@douglas
douglas / update_git_repos.sh
Created October 14, 2011 15:04
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do