Skip to content

Instantly share code, notes, and snippets.

@rusty-key
rusty-key / rename.sh
Created September 25, 2015 18:20
Mass recursive rename (file extension change)
find . -depth -name "*.scss" -exec sh -c 'mv "$1" "${1%.scss}.css"' _ {} \;
if($page && !empty($page) && $page!="") {
$offset = (int)$per_page * (int)$page;
$querystr = "
SELECT p.ID, p.post_title, m.meta_value AS date
FROM $wpdb->posts p INNER JOIN $wpdb->postmeta m ON p.ID = m.post_id
JOIN st_icl_translations tr ON p.ID = tr.element_id
WHERE p.post_type = 'play' AND p.post_status = 'publish'
AND tr.language_code = '$lang'
AND m.meta_key LIKE 'dates_%_date'
AND CAST(m.meta_value AS SIGNED) > $from
@rusty-key
rusty-key / show-widget.js
Last active August 24, 2016 15:09
widget animation
// какая-то функция, которая показывает виджет
function showWidget($widget) {
$widget.appendTo($parentElement);
setTimeout(() => {
$widget.addClass('show-widget');
}, 1);
}
{
"extends": "airbnb/legacy",
"rules": {
"vars-on-top": 0,
"func-names": 0,
"no-new": 0,
"space-before-function-paren": [2, "never"],
"no-param-reassign": 0
},
"env": {
@rusty-key
rusty-key / .gitconfig
Created October 3, 2016 11:20
Git config
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
p = push
po = push origin
{
"order": [
"custom-properties",
"dollar-variables",
{
"type": "at-rule",
"name": "mixin"
},
"declarations",
{
B _build/src
S src
PKG cmdliner lwt
FLG -w +a-4-40..42-44-45-48
@rusty-key
rusty-key / parser.js
Created September 10, 2018 13:59
PropTypes → BS
const fs = require('fs')
const path = require('path')
const definedTypes = {
'PropTypes.string': 'string',
'PropTypes.bool': 'bool',
}
const files = fs.readdirSync('src')
.filter(file => file[0] === file[0].toUpperCase() && file[0] !== '_')
@rusty-key
rusty-key / jsx2-wrapper.js
Last active May 20, 2019 16:44
jsx2 wrapper for jsx3 bindings
// requires node 12.*
const fs = require('fs')
const path = require('path')
const refmt = require('reason');
const dir = path.resolve(process.argv[2])
if (!fs.existsSync(dir)) {
console.error(`${dir} doesn't exist`);
return
@rusty-key
rusty-key / gist:67e78834649a1c4e8986a8fb91a29ff3
Created July 25, 2019 10:20 — forked from JT5D/gist:a2fdfefa80124a06f5a9
Google translate language codes
Eg. URL translating en page to es
http://translate.google.com/translate?hl=en&sl=en&tl=es&u=http://about.com
Define the web interface language to be English by adding
hl=en to the end of the URL and after the change the URL will look
like this:
http://www.google.com/search?hl=en
When you use more than one setting code in the URL, you need to use