Skip to content

Instantly share code, notes, and snippets.

View wildan3105's full-sized avatar
⌨️
Typing things remotely

Wildan S. Nahar wildan3105

⌨️
Typing things remotely
View GitHub Profile
@wildan3105
wildan3105 / server.js
Last active November 18, 2019 04:46
simple nodejs script to handle/listen callback
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true,
}));
// assume callback url is: http://localhost:3000/event
@wildan3105
wildan3105 / prepare-commit-msg.sh
Created October 29, 2019 07:59 — forked from bartoszmajsak/prepare-commit-msg.sh
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@wildan3105
wildan3105 / introrx.md
Created August 24, 2018 06:44 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
#define FCY 8000000UL // FCY = FOSC / 2
#include "libpic30.h"
#include "stdio.h"
#include "stdlib.h"
#include "p30f2020.h"
#include "xc.h"
#include "config.h"
int main(void){
U1BRG = 12; // 38400 baudrate
module.exports = {
getAllStudents: function(cb){
Std.find({}, cb)
},
getStudentByNIM: function(nim, cb){
Std.find({nim:nim}, function(err, student){
cb(null, student[0])
})
},
getStudentByLink: function(link, cb){
async.waterfall([
function(callback){
queries.getStudentByNIM(nim, function(err, std){
msg = 'You are choosing ' + lecturerChosen + ' STATUS : PENDING'
notifLength = std.notifs.length+1
callback(std[0])
})
},
function(callback){
queries.addNotif(nim, msg, notifLength, function(err){
@wildan3105
wildan3105 / schema.js
Created June 23, 2018 06:23
MongoDB schema
var mongoose = require('mongoose')
var Schema = mongoose.Schema
var lecturerSchema = new Schema ({
name: String,
username: String,
kk: String,
kk_initial: String,
img_url: String,
@wildan3105
wildan3105 / gist:29cf27a01c50a5c0cb6c9c7daf7f6c2b
Created April 11, 2018 03:06 — forked from tamoyal/gist:10441108
Create super user and database user in Mongo 2.6
# Create your superuser
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
# Alias for convenience (optional and at your own risk)
$ echo 'alias mongo="mongo --port 27017 -u someadmin -p secret --authenticationDatabase admin"' >> ~/.bash_profile
$ source ~/.bash_profile
const byte adcPin = 0; // A0
const int MAX_RESULTS = 256;
volatile int results [MAX_RESULTS];
volatile int resultNumber;
// ADC complete ISR
ISR (ADC_vect)
{
if (resultNumber >= MAX_RESULTS)
ADCSRA = 0; // turn off ADC
@wildan3105
wildan3105 / .estlintrc.json
Last active September 16, 2017 11:56
Airbnb-inspired eslintrc configuration
{
"extends": "eslint:recommended",
"env": {
"es6":true,
"browser": true,
"node": true
},
"rules": {
"arrow-body-style":"error",
"array-bracket-spacing":"error",