Skip to content

Instantly share code, notes, and snippets.

View steelx's full-sized avatar
🎮
GameDev by night

Ajinkya Borade steelx

🎮
GameDev by night
View GitHub Profile
@steelx
steelx / gulpfile-express.js
Created November 2, 2015 05:24 — forked from mollerse/gulpfile-express.js
Gulpfile for livereload + static server
var gulp = require('gulp'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
concat = require('gulp-concat'),
embedlr = require('gulp-embedlr'),
refresh = require('gulp-livereload'),
lrserver = require('tiny-lr')(),
express = require('express'),
livereload = require('connect-livereload')
livereloadport = 35729,
@steelx
steelx / README.md
Created July 29, 2013 17:10 — forked from m4dz/README.md

This files contains my boilerplates for jQuery plugins.

// Ajax File upload with jQuery and XHR2
// Sean Clark http://square-bracket.com
// xhr2 file upload
// data is optional
$.fn.upload = function(remote,data,successFn,progressFn) {
// if we dont have post data, move it along
if(typeof data != "object") {
progressFn = successFn;
successFn = data;
}
@steelx
steelx / LESS-css-quicky
Created October 29, 2013 05:00
LESS css quick copy paste
@mobile: ~"only screen and (max-width: 529px)";
@tablet: ~"only screen and (min-width: 530px) and (max-width: 949px)";
@desktop: ~"only screen and (min-width: 950px) and (max-width: 1128px)";
@desktop-xl: ~"only screen and (min-width: 1129px)";
var fs = require('fs');
// Specify the locales you are interested here.
var locales = ['en', 'fr'];
var i;
var localesData = Object.create(null);
var prefix = 'data:text/javascript;base64,';
var outputPrefix = "angular.module('tmh.dynamicLocalePreload', ['tmh.dynamicLocale'])" +
".config(['tmhDynamicLocaleProvider', function(tmhDynamicLocaleProvider) {" +
"tmhDynamicLocaleProvider.localeLocationPattern('{{base64Locales[locale]}}');" +
@steelx
steelx / generateThumb.js
Last active May 14, 2018 09:25
firebase functions thumbnail
const mkdirp = require('mkdirp-promise');
const gcs = require('@google-cloud/storage')({ keyFilename: 'service-account-key.json' });
const admin = require('firebase-admin');
var serviceAccount = require('./service-account-key.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://<PROJECT_ID>.firebaseio.com'
});
@steelx
steelx / listFiles.js
Created May 13, 2018 14:05
firebase storage list files
// listFiles.js
const gcs = require('@google-cloud/storage')({keyFilename: 'service-account-key.json'});
module.exports = function listFiles(request, response) {
if(!request.body.uid) {
response.status(422).send({error: "Missing UID"});
}
console.log("request.body.uid", request.body.uid);
// Creates a client
const bucketName = '<HIDDEN PROJECT ID>';
@steelx
steelx / getGravatarUrl
Created December 2, 2013 16:03
AngularJS get Gravatar url on email
var ajinkyaApp = angular.module('ajinkyaApp', []);
ajinkyaApp.controller('EditProfileController', function($scope){
$scope.user = {};
$scope.getGravatarUrl = function(email) {
// MD5 (Message-Digest Algorithm) by WebToolkit
//
var defaultGravatarPic = 'http://www.gravatar.com/avatar/000.jpg?s=200';
@steelx
steelx / go.md
Last active November 14, 2019 14:34
Add version to GO package

Tag your git repository with a version number (ideally based on the semantic versioning specification e.g. v0.0.0).

git tag -a v0.0.0 -m "First tag." Push the version number to the remote repository.

git push --tags Generate an up-to-date version_PLATFORM.go file (normally done by your CI server)

go generate The version_PLATFORM.go file gets automatically updated with data from the tag.

#Headless Setup of Raspberry Pi Zero W (Raspberry Pi 3 Wireless) (macOS)

  1. Formatt the Micro SD card - Open a terminal and type 'diskutil list'. Find your card and copy the disk name (For example: /dev/disk4). Format the card with diskutil eraseDisk ExFat temp disk4(Use your disk here)
  2. Download Raspbian - wget https://downloads.raspberrypi.org/raspbian_lite_latest
  3. Unmount the SD card - diskutil unmountDisk /dev/disk4 or whatever your disk path is
  4. Mount the Raspbian image to the card - sudo dd if=PATH-TO-RASPBIAN-IMAGE of=/dev/disk4` or whatever your disk path is
  5. Enable SSH on the Pi - cd /volumes && ls. You should see a boot partition from the SD card cd boot && touch ssh
  6. Setup WiFi on the PI - While still in the boot partition of the card type nano wpa_supplicant.conf and enter network={ ssid="YOUR-SSID" psk="YOUR-WIFI-PASSWORD" }
  7. Boot the PI - Unmount the card diskutil unmountDisk /dev/disk4 (or whatever your disk path is) and put it in the