Skip to content

Instantly share code, notes, and snippets.

View brickpop's full-sized avatar

Jør∂¡ brickpop

View GitHub Profile
@brickpop
brickpop / FSWrapper.js
Last active August 29, 2015 14:02
Phonegap File API JS Wrapper
// Wrapping of the example found on https://gist.github.com/alunny/1904992
// Jordi Moraleda
// This example works on org.apache.cordova.file version 1.1.0 and 1.2.0
//
// If you are using version 1.3.0, check out the file below
// https://gist.github.com/jmoraleda/78551f439578f7c132c8#file-fswrapper-v1-3-js
function FSWrapper(options, callback) {
var self = this;
@brickpop
brickpop / amazon-install.sh
Last active August 29, 2015 14:07
Amazon Linux Install Script
# SWAP
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
sudo chown root:root /swapfile1
sudo chmod 0600 /swapfile1
sudo mkswap /swapfile1
sudo swapon /swapfile1
sudo echo "/swapfile1 swap swap defaults 0 0" > /etc/fstab
# MAIN SYSTEM UPDATE
sudo yum update -y
@brickpop
brickpop / apn-pem-convert.sh
Last active July 27, 2016 17:02
iOS APN certificate conversion
#!/bin/bash
# CREATE CERTS
echo "Android: http://dev.tapjoy.com/faq/how-to-find-sender-id-and-api-key-for-gcm/"
echo "iOS: http://quickblox.com/developers/How_to_create_APNS_certificates"
# EXTRACT P12 > PEM
openssl pkcs12 -in apn-push-prod.p12 -out apn-push-prod.pem -nodes -clcerts
@brickpop
brickpop / gulpfile.js
Last active July 27, 2016 16:59
Gulp iOS/Android icon/splash generator
var gulp = require('gulp');
// ICONS
gulp.task('icons', function() {
var lwip = require('lwip');
// Default
lwip.open('resources/icon.png', function(err, image){
if(err) return console.error(err);
image.batch().cover(57, 57).writeFile('resources/ios/icon/icon.png', 'png', {transparency: 'auto'}, function(){if(err)console.error(err);});
@brickpop
brickpop / push.android.js
Last active September 13, 2016 22:34
NodeJS Push Notification Routines
var config = require('../config.js');
var gcm = require("node-gcm");
var gcmConnection = new gcm.Sender(config.GCM_KEY);
global.Promise = require('bluebird');
var zip = require('lodash/zip');
var feedbackHandlers = [];
function send(pushTokens, message, payload, expiry, unreadCounter){
return new Promise((resolve, reject) => {
@brickpop
brickpop / .babelrc
Last active July 27, 2016 18:00
Development Config Files
{
"presets": [
"es2015",
"react",
"stage-1"
],
"plugins": [
"transform-decorators-legacy"
],
"compact": true
@brickpop
brickpop / index.js
Created July 27, 2016 18:07
Mailing with images attached
import config from 'config';
import { sendMail } from './mailer';
export function sendValidationEmail(recipientEmail, userId, validationToken){
let htmlContent, txtContent, title;
title = "Welcome to Right Side Coffee"
htmlContent = `<html><head><style> body { font-family: monospace; }</style></head><body>
<p>Welcome to Right Side Coffee,</p>
<p>To activate your account, click on <a href="${config.SERVER_URL}/en/confirm/${userId}/${validationToken}">the link here</a>.</p>
@brickpop
brickpop / index.js
Last active May 5, 2017 11:08
Build ng-admin with Webpack
// CSS
require('../node_modules/ng-admin/build/ng-admin.min.css');
// ALL IN ONE
require('ng-admin/build/ng-admin-only.min');
// JS
// var angular = require('angular/angular.min.js');
require('angular-ui-bootstrap/dist/ui-bootstrap-tpls.js');
require('angular-bootstrap/ui-bootstrap.min');
@brickpop
brickpop / 1-server-setup.sh
Last active May 23, 2018 18:41
Debian Jessie Server setup
#!/bin/bash
# Vanilla Debian Jessie Setup
sudo su -
# DEBIAN JESSIE SETUP SCRIPT
# -------------------------------------------------------------------------
# VARIABLES