Skip to content

Instantly share code, notes, and snippets.

💭
¯\_(ツ)_/¯

Andrew M. r3nya

💭
¯\_(ツ)_/¯
Block or report user

Report or block r3nya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View show_file.php
function show_files($dir_name, $regexp = '/^([^.])/') {
$files = preg_grep($regexp, scandir($dir_name));
if ($regexp != '/^([^.])/') {
$files = preg_grep('/^([^.])/', scandir($dir_name));
}
if ($key_del = array_search('key.txt', $files)) {
unset($files[$key_del]);
}
View translate.rb
require 'yandex-translator'
class Translate
attr_accessor :words_for_translate
attr_reader :translated_word
def initialize(words)
set_api_key
@words_for_translate = words
end
def translate(options = nil)
View links.md
View gulpfile.coffee
gulp = require 'gulp'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
uglify = require 'gulp-uglify'
plumber = require 'gulp-plumber'
notify = require 'gulp-notify'
slim = require 'gulp-slim'
serve = require "gulp-serve"
sass = require 'gulp-ruby-sass'
View bower_how_to_use.md

Bower, how to use

app.js - фрагмент кода из обычного приложения на express.js директорию bower_components сделаем для отдачи статических файлов, так же как и директорию public

app.use(express.static(path.join(__dirname, 'public')));
app.use('/bower_components',  express.static(__dirname + '/bower_components'));
  • Далее установим bootstrap
View node-app.sh
#!/bin/sh
##
## Redhat / Linux / LSB
##
# chkconfig: 345 80 20
# description: Startup script for Express / Node.js application with the \
## forever module.
##
## A modification of https://gist.github.com/1339289
##
View nodejs
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
View openvpn.md

OpenVPN on Ubuntu 12.10 at DigitalOcean

Install OpenVPN

sudo apt-get install openvpn

Generate Server Certificates

sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa2
cd /etc/openvpn/easy-rsa2
View agularjs reverse geocoding
// to get the current latitude and longitude from browser
// credits https://github.com/arunisrael/angularjs-geolocation
'use strict';
angular.module('geolocation',[]).constant('geolocation_msgs', {
'errors.location.unsupportedBrowser':'Browser does not support location services',
'errors.location.notFound':'Unable to determine your location',
});
angular.module('geolocation')
View simple_playbook.yml
---
- hosts: web
user: root
vars:
http_port: 80
max_clients: 200
tasks:
- name: install apache
yum: name=httpd state=latest
- name: write apache config
You can’t perform that action at this time.