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 t | |
import ( | |
"time" | |
) | |
type NowFunc func() time.Time | |
var Now = func() time.Time { return time.Now() } | |
func NowForce(unix int) { |
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
var facade = require('facade'), | |
handlers = require('handlers'); | |
app.use("/verification/:verificationId", funciton (req, res) { | |
facade.getUserForVerificationId(req.params.verificationId) | |
.then(handlers.successHandler, handlers.errorHandler); | |
}); |
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
https://www.postgresql.org/docs/9.4/static/monitoring-stats.html | |
https://www.postgresql.org/docs/9.4/static/functions-admin.html | |
-- show blocking pids in a nice tree | |
-- query as blocked_query | |
-- 9.6++ | |
select pid, usename, | |
age(query_start, clock_timestamp()), | |
pg_blocking_pids(pid) as blocked_by, | |
query |
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
class Hash | |
# options: | |
# :exclude => [keys] - keys need to be symbols | |
def to_ostruct_recursive(options = {}) | |
convert_to_ostruct_recursive(self, options) | |
end | |
private | |
def convert_to_ostruct_recursive(obj, options) | |
result = obj |
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
<?php | |
/** | |
* Post a message from a bot to a group | |
* | |
* $groupId (string) GroupId of the group to post the message | |
* $strMessage (string) Text of the message to post (limit of 1000 characters) | |
* $strBotId (string) ID of the bot which will post the message | |
* $mentionUsers (array) [optional] array of userIds to mention (uses attachment) | |
* Example array of userIds: |
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
alias server='open http://localhost:8000 && python -m SimpleHTTPServer' |
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
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" . |
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 ( | |
"log" | |
"math" | |
) | |
func Round(val float64, roundOn float64, places int ) (newVal float64) { | |
var round float64 | |
pow := math.Pow(10, float64(places)) |
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
/** | |
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded | |
* templates and such with AngularJS. Use this simple directive to | |
* tame this beast once and for all. | |
* | |
* Usage: | |
* <input type="text" autofocus> | |
* | |
* License: MIT | |
*/ |
OlderNewer