Boilerplate w/ Laravel example: https://github.com/jpalala/laravel-customjs-boilerplate
This file contains hidden or 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 | |
| $ENV['GITHUB_CLIENT_SECRET' => 'YOUR_CLIENT_SECRET', 'GITHUB_CLIENT_ID' => 'YOUR_CLIENT_ID']; | |
| if (!function_exists('dd')) { | |
| function dd() | |
| { | |
| echo '<pre>'; | |
| array_map(function($x) {var_dump($x);}, func_get_args()); | |
| die; | |
| } |
function update(target) {
var sources = [].slice.call(arguments, 1);
sources.forEach(function (source) {
Object.getOwnPropertyNames(source).forEach(function(propName) {
Object.defineProperty(target, propName,
Object.getOwnPropertyDescriptor(source, propName));
});
This file contains hidden or 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 { createReadStream, createWriteStream } = require('fs'); | |
| const { AsyncParser } = require('json2csv'); | |
| const fields = ['field1', 'field2', 'field3']; | |
| const opts = { fields }; | |
| const transformOpts = { highWaterMark: 8192 }; | |
| // Using the promise API | |
| const input = createReadStream(inputPath, { encoding: 'utf8' }); |
This file contains hidden or 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 | |
| # Test and package your PHP project. | |
| # Add steps that run tests, save build artifacts, deploy, and more: | |
| # https://docs.microsoft.com/azure/devops/pipelines/languages/php | |
| pool: | |
| vmImage: 'Ubuntu 16.04' | |
| variables: | |
| phpVersion: 7.2 |
Source from Log users click without slowing the website down
$(function(){
$('div.join-link').click(function(){
var data-url = $(this).attr('data-target-url');
$.ajax({
type: 'POST',
url: 'http://yourdomain.com/log_clicks.php',
success:function(){window.location.href= data-url;},Idea to rate limit posts to comments
Idea that at least 1 admin / 2-3 community members approve first
2-3 community members approve to be in front page - if they find it interesting it goes on the front page
//https://www.npmjs.com/package/get-website-favico
This file contains hidden or 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 | |
| # Source: https://github.com/technicalpickles/pickled-vim/blob/master/script/setup | |
| set -e | |
| cd "$(dirname "$0")/.." | |
| if [ "$(uname -s)" = "Darwin" ]; then | |
| brew bundle check >/dev/null 2>&1 || { | |
| echo "==> Installing Homebrew dependencies…" | |
| brew bundle | |
| } |
This file contains hidden or 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 | |
| SessionHandler implements SessionHandlerInterface , SessionIdInterface { | |
| /* Methods */ | |
| public close ( ) : bool | |
| public create_sid ( ) : string | |
| public destroy ( string $id ) : bool | |
| public gc ( int $max_lifetime ) : int|bool | |
| public open ( string $path , string $name ) : bool | |
| public read ( string $id ) : string | |
| public write ( string $id , string $data ) : bool |
This file contains hidden or 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
| #### | |
| # ZSH function to auto-switch to correct Node version | |
| # https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5 | |
| # | |
| # - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does. | |
| # | |
| # - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING. | |
| # | |
| # - Works correctly if your .nvmrc file contains something relaxed/generic, | |
| # like "4" or "v12.0" or "stable". |