Skip to content

Instantly share code, notes, and snippets.

Avatar

MDMCDC anovsiradj

View GitHub Profile
@yidas
yidas / js-encode-decode.md
Last active Dec 5, 2021
JavaScript HTML Entities Encode & Decode
View js-encode-decode.md
@azyobuzin
azyobuzin / Dockerfile
Last active Nov 19, 2020
Wine 上で Mono を動かすやつ
View Dockerfile
FROM ubuntu:17.04
# apt-get update がクソ遅いので日本サーバーに変更
RUN sed -i 's|//archive\.ubuntu\.com|//jp\.archive\.ubuntu\.com|g' /etc/apt/sources.list
RUN dpkg --add-architecture i386 && \
apt-get update -y && \
apt-get install -y wget apt-transport-https software-properties-common && \
wget -O - https://dl.winehq.org/wine-builds/Release.key | apt-key add - && \
apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ && \
anonymous
anonymous / overpass.geojson
Created Apr 26, 2017
data exported by overpass turbo
View overpass.geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bladeSk
bladeSk / SQLite-PHP-quickstart.php
Last active Nov 30, 2021
SQLite3 PHP Quickstart Tutorial
View SQLite-PHP-quickstart.php
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
@hikari-no-yume
hikari-no-yume / example.php
Created Mar 20, 2017
function chaining for PHP 7
View example.php
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
@shakee93
shakee93 / .htaccess
Created Jan 31, 2017
Laravel Apache hide .env and several security settings via .htaccess
View .htaccess
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden // in here specify .example extension of the file
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Order allow,deny
Deny from all
</Files>
# in here specify full file name sperator '|'
@aaronpk
aaronpk / canonical.php
Created Dec 20, 2016
Given an input URL, find the canonical URL after following redirects and looking at rel=canonical
View canonical.php
<?php
if(!isset($_GET['url'])) {
?>
<form action="" method="get">
<input type="url" name="url">
<input type="submit" value="Go">
</form>
<?
die();
}
@freekrai
freekrai / demo.php
Last active Jul 2, 2021
PHP session-based rate limiter for APIs
View demo.php
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.
@forecho
forecho / SearchModel.php
Last active Nov 3, 2021
Yii2 Search Model
View SearchModel.php
<?php
/**
* author : forecho <caizhenghai@gmail.com>
* createTime : 2015/12/29 15:33
* description:
*/
namespace common\components;
use yii\base\InvalidParamException;