This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('yourModule') | |
.directive('tabsSwipable', ['$ionicGesture', function($ionicGesture){ | |
// | |
// make ionTabs swipable. leftswipe -> nextTab, rightswipe -> prevTab | |
// Usage: just add this as an attribute in the ionTabs tag | |
// <ion-tabs tabs-swipable> ... </ion-tabs> | |
// | |
return { | |
restrict: 'A', | |
require: 'ionTabs', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var mysql = require('mysql'); | |
var config = require('../config'); | |
var pool = mysql.createPool(config.mysql); | |
exports.exec = function(query, params, callback) { | |
if (!query) { | |
callback(true); | |
} | |
pool.getConnection(function(err, connection) { | |
if(err) { console.log(err); callback(true); return; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Text inputs | |
input:not([type]), | |
input[type=text], | |
input[type=password], | |
input[type=email], | |
input[type=url], | |
input[type=time], | |
input[type=date], | |
input[type=datetime-local], | |
input[type=tel], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "encoding/json" | |
type Person1 struct { | |
Name string | |
Age string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ReadGzFile(filename string) ([]byte, error) { | |
fi, err := os.Open(filename) | |
if err != nil { | |
return nil, err | |
} | |
defer fi.Close() | |
fz, err := gzip.NewReader(fi) | |
if err != nil { | |
return nil, err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT Id, Body, AcceptedAnswerId, Score, ParentId, CreationDate | |
FROM Posts | |
WHERE CreationDate BETWEEN '2014-01-01' AND '2017-01-01' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v bitbucket.com/mycompany/my_package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nohup command </dev/null >/dev/null 2>&1 & # completely detached from terminal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calculateDistance(rssi) { | |
var txPower = -59 //hard coded power value. Usually ranges between -59 to -65 | |
if (rssi == 0) { | |
return -1.0; | |
} | |
var ratio = rssi*1.0/txPower; | |
if (ratio < 1.0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add this file as a crontab task | |
# Example: * * * * * bash /opt/dir/task/stayalive.sh | |
# If the collector is not runing, execute it | |
if [[ ! `pgrep -f "python main.py"` ]]; then | |
cd /opt/dir/process && ./process-name | |
fi |
OlderNewer