Skip to content

Instantly share code, notes, and snippets.

View ofstudio's full-sized avatar

Oleg Fomin ofstudio

View GitHub Profile

Всем-всем! Уже завтра, в пятницу начнется долгожданный Westie Fest 2013! Несколько важных новостей :)

Для начала хотим представить вам информационного партнера Westie Fest 2013: Телеканал «HD Life» — музыкальные программы, видеоклипы, концерты, информационно-развлекательные программы, модные показы и знаменательные события! http://www.hdlife.ru/

О новостях:

  1. В пятницу у нас будет Welcome Party с 21:00, где мы все наконец встретимся и как следует прогреем танцпол! Также, в пятницу можно будет оплатить участие всем, кто еще не сделал этого.
@ofstudio
ofstudio / ByTagHelper.js
Last active August 29, 2015 14:16
Query Ghost posts by tag
var hbs = require('express-hbs'),
api = require('core/server/api'),
async = require('express-hbs/lib/async'), // To redefine `registerAsyncHelper`
registerAsyncHelper;
// Redefine `registerAsyncHelper` from `express-hbs`
registerAsyncHelper = function (name, fn) {
hbs.handlebars.registerHelper(name, function (context, options) {
// Pass `[context, options]` as arg instead of `context` only
return async.resolve(fn.bind(this), [context, options]);
@ofstudio
ofstudio / heplers.js
Last active September 9, 2021 09:55
Couple useful heplers for ghost
var hbs = require('express-hbs'),
api = require('core/server/api'),
_ = require('lodash'),
async = require('express-hbs/lib/async'), // To redefine `registerAsyncHelper`
registerAsyncHelper;
// Redefine `registerAsyncHelper` from `express-hbs`
registerAsyncHelper = function (name, fn) {
hbs.handlebars.registerHelper(name, function (context, options) {
// Pass `[context, options]` as arg instead of `context` only
@ofstudio
ofstudio / ghost-post-by-tags.js
Last active August 29, 2015 14:14
Ghost browse posts by tag snippet
var api = require('ghost/core/server/api');
api.posts.browse({
context: {
internal: true
},
tag: 'music'
}).then(function (responce){
console.log(responce);
});
@ofstudio
ofstudio / DCevent simple translit example
Created January 14, 2015 15:41
Транслитерация для DCevent.js
<!-- Скрипт транслитерации -->
<script>
function translate(str) {
function strtr(s, replacePairs) {
"use strict";
var str = s.toString(), key, re;
for (key in replacePairs) {
if (replacePairs.hasOwnProperty(key)) {
re = new RegExp(key, "g");
@ofstudio
ofstudio / meta.hbs
Created January 6, 2015 13:43
Meta tags snippet for Ghost Themes
{{!-- Tested on Ghost 0.5.7. --}}
{{!-- IMPORTANT! Some things are more likely to work in a different way in future versions of Ghost. Check the documentation --}}
{{#is "index, tag, author"}} {{!-- Meta for index, tag and author contexts --}}
{{#is "index"}}
<title>{{@blog.title}}</title>
<meta name="description" content="{{@blog.description}}"/>
<meta property="og:title" content="{{@blog.title}}"/>
<meta itemprop="name" content="{{@blog.title}}"/>
{{/is}}
{{#is "tag"}}
@ofstudio
ofstudio / OSAjs-itunes.js
Created December 28, 2014 12:01
Example of iTunes scripting in OS X with Javascript
/**
* Example of iTunes scripting in OS X with Javascript
* Open /Applications/Script Editor.app, paste the code and click Run button
*
* @author Oleg Fomin <ofstudio@gmail.com>
*
*/
var my_app = Application.currentApplication(),
itunes = new Application('iTunes'),
@ofstudio
ofstudio / OSAjs-dialogs.js
Last active August 29, 2015 14:12
Example of dialogs / notifications scripting in OS X with Javascript
/**
* Example of dialogs / notifications scripting in OS X with Javascript
* Open /Applications/Script Editor.app, paste the code and click Run button
*
* @author Oleg Fomin <ofstudio@gmail.com>
*
*/
var result,
my_app = Application.currentApplication();
@ofstudio
ofstudio / OSAjs-file-folder-exists.js
Created December 28, 2014 11:58
Example of file / folders scripting in OS X with Javascript
/**
* Example of file / folders scripting in OS X with Javascript
* Open /Applications/Script Editor.app, paste the code and click Run button
*
* @author Oleg Fomin <ofstudio@gmail.com>
*
*/
function file_exists(name) {
try {
@ofstudio
ofstudio / get_password.sh
Created December 14, 2014 16:39
Get password from OS X Keychain shell / bash function
# Get password from OS X Keychain function
# Replace %ACCOUNT_NAME% with account name of Keychain item
# See `man security` for more info
get_pw () {
security 2>&1 >/dev/null find-generic-password -ga "%ACCOUNT_NAME%" \
| sed 's/password: "\(.*\)"/\1/'
}
# Don't store server credentials in plain text!
PASS=$(get_pw)