Skip to content

Instantly share code, notes, and snippets.

View arvi's full-sized avatar
🎯
Focusing

arvi

🎯
Focusing
View GitHub Profile
@anggadarkprince
anggadarkprince / AppHelper.java
Last active May 2, 2023 22:39
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
private boolean isServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)){
if("com.example.MyNeatoIntentService".equals(service.service.getClassName())) {
return true;
}
}
return false;
}
@cayasso
cayasso / index.js
Created May 30, 2017 20:10
Bulk writes in mongoose
const mongoose = require('mongoose')
const { Types, Schema } = mongoose
// Connect to mongo
mongoose.connect('mongodb://localhost/bulk');
// Set model schema
const ArticleSchema = new Schema({
title: {
type: String,
@julianshen
julianshen / CircleTransform.java
Last active November 6, 2023 12:47
CircleTransform for Picasso
/*
* Copyright 2014 Julian Shen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@NightlyNexus
NightlyNexus / OkHttpStack.java
Created May 13, 2016 21:27
OkHttp 3 implementation of Volley's HttpStack
/*
* Copyright (C) 2016 Eric Cochran
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@vikas5914
vikas5914 / log.js
Last active December 12, 2023 14:09
Custom Logger Library with winston
const { createLogger, format, transports } = require('winston')
const moment = require('moment')
// set default log level.
const logLevel = 'info'
var logger = createLogger({
level: logLevel,
levels: {
fatal: 0,
@learncodeacademy
learncodeacademy / flightplan-deploy.md
Last active January 7, 2024 11:58
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@katychuang
katychuang / remove_brew-mongo_osx.sh
Last active January 30, 2024 12:20
remove mongodb that was installed via brew
#!/usr/bin/env sh
# first check to see if mongo service is running. you can't delete any files until the service stops so perform a quick check.
launchctl list | grep mongo
# NOTE: the pipe | symbol means the commands on the right performs on the output from the left
# grep is a string search utility. `grep mongo` means search for the substring mongo
# use the unload command to end the mongo service. this is required to 'unlock' before removing the service.
# first look for the file to delete
MONGO_SERVICE_FILE=$(ls ~/Library/LaunchAgents/*mongodb*)
@crtr0
crtr0 / client.js
Created June 8, 2012 17:02
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't