Skip to content

Instantly share code, notes, and snippets.

View umkasanki's full-sized avatar

Oleg Tishkin umkasanki

View GitHub Profile
@benlilley
benlilley / .htaccess
Created April 22, 2018 22:47
Default Craft CMS .htaccess
# ----------------------------------------------------------------------
# | Cleaning URLs |
# ----------------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
# Remove www from URL's
RewriteCond %{HTTP_HOST} ^www\.(.+)
# RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
@ghosh
ghosh / micromodal.css
Last active July 1, 2025 17:27
Demo modal styles for micromodal.js and corresponding expected html. If using this, set the `awaitCloseAnimation` in config to true
/**************************\
Basic Modal Styles
\**************************/
.modal {
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
}
.modal__overlay {
position: fixed;
@stubailo
stubailo / fetch-graphql.js
Created September 5, 2017 08:15
Call a GraphQL API with fetch
require('isomorphic-fetch');
fetch('https://1jzxrj179.lp.gql.zone/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ query: '{ posts { title } }' }),
})
.then(res => res.json())
.then(res => console.log(res.data));
@douglascayers
douglascayers / UploadFile.html
Last active April 18, 2021 14:48
JavaScript snippet for uploading fille to Salesforce as ContentVersion and sharing to record as ContentDocumentLink via jsforce and jquery.
<apex:page>
<head>
<script src="{!$Resource.jquery224}"></script> <!-- https://jquery.com/ -->
<script src="{!$Resource.jsforce170}"></script> <!-- https://jsforce.github.io/ -->
<script>$j = jQuery.noConflict();</script>
</head>
<body>
<form>
@varnav
varnav / redirect_browser_language.nginx
Last active April 4, 2025 14:36
Nginx can redirect to language subsite based on browser language
map $http_accept_language $index_redirect_uri {
default "/en/";
"~(^|,)en.+,ru" "/en/";
"~(^|,)ru.+,en" "/ru/";
"~(^|,)en" "/en/";
"~(^|,)ru" "/ru/";
}
location = / {
return 302 $index_redirect_uri;
@davebarnwell
davebarnwell / PHP composer tools.md
Last active May 28, 2025 15:30
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@engram-design
engram-design / export.php
Last active August 21, 2024 08:51
ExpressionEngine PHP Export into JSON
<?php
$channel = $_GET['id'];
$content = array();
$fields_query = $this->EE->db->query("SELECT * FROM exp_channel_fields LEFT JOIN exp_channels ON exp_channel_fields.group_id = exp_channels.field_group WHERE exp_channels.channel_id = '$channel'");
$entries_query = $this->EE->db->query("SELECT * FROM exp_channel_data cd INNER JOIN exp_channel_titles ct ON cd.entry_id = ct.entry_id WHERE cd.channel_id = '$channel'");
$fields = $fields_query->result_array();
@roylee0704
roylee0704 / vagrant.sh
Last active June 23, 2019 10:09
vagrant commands (on homestead)
#INTRODUCTION
# Vagrant is a virtual machine manager, it allows you to script the virtual machine configuration as well as the provisioning.
# add 'laravel/homestead' to vm/virtual-box via vagrant, ref: https://laravel.com/docs/5.3/homestead#first-steps
vagrant box add laravel/homestead -c
# up and running, do it in ~/.homestead
vagrant init hashicorp/precise64
vagrant up
@manfromanotherland
manfromanotherland / hs-form.css
Last active August 13, 2022 11:32
Hubspot: Forms CSS selectors and sample HTML markup http://designers.hubspot.com/docs/cos/hubspot-form-markup
/* All HubSpot Forms
========================================================================== */
/* Form Field (selector for form field wrapper) */
.hs-form .hs-form-field {}
/* Descriptions (targets class applied to Help Text divs) */
.hs-form .hs-field-desc {}
/* Labels (selects field labels and error messages) */
// Because we want to access DOM node,
// we initialize our script at page load.
window.addEventListener('load', function () {
// This variables will be used to store the form data
var text = document.getElementById("i1");;
var file = {
dom : document.getElementById("i2"),
binary : null
};