Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View SleepWalker's full-sized avatar

Sviatoslav SleepWalker

View GitHub Profile
<snippet>
<content><![CDATA[
<div class="$1">
$2
</div><!-- .$1 -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>di</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
@SleepWalker
SleepWalker / getdump.php
Last active August 29, 2015 14:02
MYSQL Dump downloader
<?php
// thanks to: http://stackoverflow.com/a/19575620/2039203
$DBUSER="user";
$DBPASSWD="password";
$DATABASE="user_db";
$filename = $_SERVER['HTTP_HOST'] . "-" . date("d-m-Y") . ".sql.gz";
$mime = "application/x-gzip";
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */
@media (orientation: landscape) {
body {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}
@SleepWalker
SleepWalker / css-orientation-alert
Created July 18, 2014 04:37
Предупреждение о том, что необходимо перевернуть девайс на чистом CSS
@media only screen and (min-device-width : 320px) and (max-device-width : 568px) and (orientation : landscape) {
html {
background: #333;
}
body:before {
content: "Turn your phone to portrait";
color: #888;
font-size: 11px;
text-transform: uppercase;
@SleepWalker
SleepWalker / stargazers-location-search.js
Last active August 29, 2015 14:06
Simple script to search developers by the Location (city, country) in the "stargazers" list of repository.
(function() {
/**
* Simple script to search developers by the Location (city, country) in the "stargazers" list of repository.
* To use it, simple go to the `/[your-repo]/stargazers` url, open console and execute this script. You will
* see profile links in the console (console.info()) output
*
* https://gist.github.com/SleepWalker/e6f54de8dfa625b37974
*/
var usersParsed = 0,
found = 0;
/**
* Outputs a new function with interpolated object property values.
* Use like so:
* var fn = makeInterpolator('some/url/{param1}/{param2}');
* fn({ param1: 123, param2: 456 }); // => 'some/url/123/456'
*/
var makeInterpolator = (function() {
var rc = {
'\n': '\\n', '\"': '\\\"',
'\u2028': '\\u2028', '\u2029': '\\u2029'
(function addXhrProgressEvent($) {
// Patch for progress event support
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: $.noop,
xhr: function() {
var xhr = originalXhr(), that = this;
if (xhr) {
if (typeof xhr.addEventListener == "function") {
@SleepWalker
SleepWalker / flexbox.less
Last active August 29, 2015 14:18 — forked from jayj/flexbox.less
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-moz-@{display}";