Skip to content

Instantly share code, notes, and snippets.

💭
ШТО

Alex Antonyuk dev4dev

💭
ШТО
Block or report user

Report or block dev4dev

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
@dev4dev
dev4dev / Postgres
Created Apr 17, 2011
start/stop postgres
View Postgres
#!/usr/local/bin/ruby
if !File.exist?('/usr/local/var/postgres/postmaster.pid') && ARGV[0] == 'start'
p %x[pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start]
p 'PG Started'
end
if File.exist?('/usr/local/var/postgres/postmaster.pid') && ARGV[0] == 'stop'
%x[pg_ctl -D /usr/local/var/postgres stop -s -m fast]
p 'PG Stopped'
@dev4dev
dev4dev / gist:1313553
Created Oct 25, 2011
pop file information from $_FILES array
View gist:1313553
function pop_file(&$files)
{
## single file
if (!is_array($files['name'])) {
$temp = $files;
$files = array('name' => array());
return $temp;
}
## as array
@dev4dev
dev4dev / redis
Created Feb 28, 2012
start/stop redis-server
View redis
#!/usr/bin/env ruby -wKU
redis_bin = %x[which redis-server].strip
redis_cli = %x[which redis-cli].strip
redis_pid = '/usr/local/var/run/redis.pid'
redis_cfg = '/usr/local/etc/redis.conf'
if File.exists? redis_pid
## stop redis
print 'stopping redis-server...'
@dev4dev
dev4dev / test.js
Created Mar 9, 2012
parse google by nodejs
View test.js
var http = require('http-get'),
HTML5 = require('html5'),
Script = process.binding('evals').Script,
util = require('util'),
jsdom = require('jsdom'),
window = jsdom.jsdom(null, null, {parser: HTML5}).createWindow(),
url = require('url');
var parser = new HTML5.Parser({
document: window.document
@dev4dev
dev4dev / .gitignore
Last active Apr 13, 2016
Git Ignore Rules
View .gitignore
Thumbs.db
.Trash
# Exclude the build directory
/build
# Exclude OS X folder attributes
.DS_Store
# Exclude user-specific XCode 3 and 4 files
@dev4dev
dev4dev / doc.md
Last active Dec 11, 2015
Git Rules
View doc.md

Git Configuration

Global ignore list

Проверить где у вас находится файл с глобальными правилами игнорирования можно коммандой

git config --global core.excludesfile

Если оказалось что у вас его нет, то выполняем следующие комманды:

cd ~
@dev4dev
dev4dev / gist:4656536
Created Jan 28, 2013
newgit shell command
View gist:4656536
function newgit() {
if [[ ! -d "$1" ]]; then
mkdir $1 && cd $_ && git init && touch README.md && git aa && git ci -m Initial
else
echo 'ERROR: such directory already exists.'
fi
}
View prob.cpp
//
// main.cpp
// prob344
//
// Created by Alex Antonyuk on 2/1/13.
// Copyright (c) 2013 Alex Antonyuk. All rights reserved.
//
#include <iostream>
@dev4dev
dev4dev / deploy.rb
Created Feb 4, 2013
Builder auto deploy script
View deploy.rb
#!/usr/bin/env ruby -wKU
# encoding: UTF-8
def fail message
puts "ERROR: " + message
exit(-1)
end
def log message
stars = '*' * (message.length + 6)
@dev4dev
dev4dev / .profile
Created Nov 10, 2014
Function for opening Xcode workspace/project
View .profile
xc() {
WORKSPACE=$(ls -dt *.xcworkspace 2>/dev/null | head -n 1)
PROJECT=$(ls -dt *.xcodeproj 2>/dev/null | head -n 1)
if [[ $WORKSPACE != '' ]]; then
open $WORKSPACE
elif [[ $PROJECT != '' ]]; then
open $PROJECT
else
echo 'R U SROUS?'
fi
You can’t perform that action at this time.