-- https://news.ycombinator.com/item?id=11396045
SELECT count(*)
FROM (SELECT id, repo_name, path
FROM [bigquery-public-data:github_repos.sample_files]
) AS F
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 | |
/* Usage Example | |
$save_handler = new MyRedisSessionModule(); | |
$save_handler->save_path = "tcp://127.0.0.1:6379?weight=1"; | |
session_set_save_handler($save_handler, true); | |
*/ | |
class MyRedisSessionModule implements SessionHandlerInterface { | |
/** |
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 saveRecord(record, args, cb) { | |
record.save(function(e) { | |
if (e && e.message == "VersionError: No matching document found.") { | |
recordModel.findById(record._id, function(e, newRecord) { | |
if(e) return cb(e); | |
reSaveRecord(record, newRecord, cb); | |
}); | |
} |
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 | |
#title :lt_install.sh | |
#description :LightTable Installation Script | |
#author :<goren.ali@yandex.com> Ali GOREN | |
#date :2015-10-31 | |
#version :0.1 | |
#usage :chmod u+x, ./lt_install.sh | |
#notes :progressFilt Source-> http://stackoverflow.com/a/4687912 | |
#bash_version :4.3.11(1)-release |
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($) { | |
$.postJSON = function(url, data, success, dataType) { | |
if (typeof data != 'string') { | |
data = JSON.stringify(data); | |
} | |
$.ajax({ | |
url : url, | |
type: "post", | |
data: data, | |
dataType: dataType || "json", |
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 scrollTo (element, duration) { | |
if (!element) { | |
return | |
} | |
var target = element.scrollHeight | |
target = Math.round(target) | |
duration = Math.round(duration) | |
if (duration < 0) { | |
return false | |
} |
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
import PropTypes from 'prop-types'; | |
import React, { Component } from 'react'; | |
import { StripeProvider } from 'react-stripe-elements'; | |
export default class AsyncStripeProvider extends Component { | |
static propTypes = { | |
apiKey: PropTypes.string.isRequired | |
}; | |
// constructor |
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 flattenTco = ([first, ...rest], accumulator) => | |
(first === undefined) | |
? accumulator | |
: (Array.isArray(first)) | |
? flattenTco([...first, ...rest]) | |
: flattenTco(rest, accumulator.concat(first)) | |
const flatten = (n) => flattenTco(n, []); | |
console.log(flatten([[1,[2,[[3]]]],4,[5,[[[6]]]]])) |
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 app = angular.module('app', ['firebase']); | |
app.controller('ctrl', function($scope, $pageArray) { | |
$scope.pageItems = $pageArray(ref, 'number'); | |
}); | |
app.factory('$pageArray', function($firebaseArray) { | |
return function(ref, field) { | |
// create a Paginate reference | |
var pageRef = new Firebase.util.Paginate(ref, field, {maxCacheSize: 250}); |
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
/** | |
* A mixin which helps you to add depth to elements according to the Google Material Design spec: | |
* http://www.google.com/design/spec/layout/layout-principles.html#layout-principles-dimensionality | |
* | |
* Please note that the values given in the specification cannot be used as is. To create the same visual experience | |
* the blur parameter has to be doubled. | |
* | |
* Adapted from a LESS version at https://medium.com/@Florian/freebie-google-material-design-shadow-helper-2a0501295a2d | |
* | |
* Original Author: Florian Kutschera (@gefangenimnetz), Conceptboard GmbH (@conceptboardapp) |
OlderNewer