Skip to content

Instantly share code, notes, and snippets.

View gavrya's full-sized avatar

Havryshchuk Oleksandr gavrya

  • Ukraine, Kiev
View GitHub Profile
@btroncone
btroncone / rxjs_operators_by_example.md
Last active July 16, 2023 14:57
RxJS 5 Operators By Example
@tristar500
tristar500 / String to Float.php
Created December 7, 2013 22:52
Convert string value with commas into a float
$val = "1,234,988.56";
$num = floatval(str_replace(",","",$val));
echo $num;
// returns - 1234988.56
@SunboX
SunboX / inlineworker.js
Created June 24, 2013 12:21
Create web workers without a separate worker JS files. Source: http://jsbin.com/owogib/8/
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
var blob = new Blob([code], {type: "application/javascript"});
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@coreymcmahon
coreymcmahon / UserRepository.php
Last active October 30, 2016 18:37
Our User repository, version 2.0. From the article: PDO for Elegant PHP Database Access, http://www.modernphpbook.com/articles/pdo-for-elegant-php-database-access - Fig 12
<?php
namespace Repository;
use \PDO;
class UserRepository
{
private $connection;
@mlconnor
mlconnor / aws_sdk_s3.php
Created January 15, 2013 18:33
Amazon AWS PHP 2 SDK S3 Example
<?php
// http://www.leofs.org/docs/s3_client.html
// i used composer with the following composer.json file and then called composer install
// {"require":{"aws/aws-sdk-php": "2.*"}}
require "vendor/autoload.php";
use Aws\Common\Enum\Region;
use Aws\S3\S3Client;
@boucher
boucher / webhook-mailer.php
Created January 31, 2012 01:45
Stripe Webhook PHP Example
<?php
// SETUP:
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at https://manage.stripe.com/#account/webhooks
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here https://manage.stripe.com/account