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
$('#form_starts_at').datepicker('option', 'onSelect', function(dateText, inst) { | |
var then = $.datepicker.parseDate(inst.settings.dateFormat, inst.lastVal); | |
var now = $.datepicker.parseDate(inst.settings.dateFormat, dateText); | |
var distance = now.getTime() - then.getTime(); | |
var ends_at = $("#form_ends_at").datepicker('getDate') | |
ends_at.setTime(ends_at.getTime() + distance); | |
$("#form_ends_at").datepicker('setDate', ends_at); | |
}); |
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 | |
function run($command) { | |
echo $command."\n"; | |
$output = null; | |
$return_var = null; | |
exec($command, $ouput, $return_var); | |
echo $output; | |
if ($return_var != 0) { | |
exit($return_var); |
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
/Users/aizat/.phpvm/v5.4.0/bin/phpize | |
./configure \ | |
--with-php-config=/Users/aizat/.phpvm/v5.4.0/bin/php-config |
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" | |
"net/http" | |
) | |
type String string | |
func (s String) ServeHTTP( |
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 best way to learn a protocol is to see the traffic between server and | |
* client. But all this is hidden from the user, so I had to find out a way | |
* get go to print out the traffic for me. | |
*/ | |
package main | |
import ( | |
"bufio" | |
"errors" |
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 "math/cmplx" | |
func Cbrt(x complex128) complex128 { | |
z := complex128(2) | |
s := complex128(0) | |
for { | |
z = z - (cmplx.Pow(z, 3) - x)/(3 * cmplx.Pow(z, 2)) |
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 | |
# test regex | |
versions=(v1.1.0 v1.2.3 v1.2.3-rc av1.2.3 a1.2.3 v1.2.3-onprem ) | |
for version in "${versions[@]}" | |
do | |
if [[ "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo success "$version" | |
else | |
echo fail "$version" |
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
// strict | |
function mb(bytes) { | |
return Math.floor(bytes / 1024 / 1024 ); | |
} | |
function print() { | |
const memoryUsage = process.memoryUsage(); | |
console.log({ | |
rss: mb(memoryUsage.rss), | |
heapTotal: mb(memoryUsage.heapTotal), |
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'; | |
const paths = new Set(); | |
const pathsData = {}; | |
const _ = require('lodash'); | |
function getPath(layer) { | |
if (layer.route && layer.route.path) { | |
return layer.route.path; | |
} else if (layer.path) { |
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
const path = require('path'); | |
const webpack = require('webpack'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const PROD = process.env.NODE_ENV === 'production'; | |
import { | |
google as googleConfig, | |
facebook as facebookConfig, |
OlderNewer