Skip to content

Instantly share code, notes, and snippets.

View develop7's full-sized avatar

Andrei Dziahel develop7

View GitHub Profile
// ==UserScript==
// @include http://www.tumblr.com/*/new/*
// @include http://www.tumblr.com/new/*
// @include http://www.tumblr.com/edit/*
// ==/UserScript==
(function(){
var ednoteel = $A($$('div.editor_note'));
var ismkdown = ednoteel.size() > 0 && ednoteel[0].text == "markdown"; //detect whether markdown mode is enabled
if (ismkdown){
$$('form div + textarea')[0].style.fontFamily = "monospace"; //set monospace font family for textarea
@develop7
develop7 / .hgignore
Created October 24, 2010 19:25
generic .hgignore for symfony project
^(?:cache|log)/
^data/sql/.*
config/databases.yml
^lib/(model|form|filter)/doctrine/(.+?Plugin/)?base/.+?\.class\.php$
^web/.+?Plugin
<?php
class Post extends BasePost
{
public function getAddedCredentialsNames(sfGuardSecurityUser $user)
{
if ($this->get('owner_id') == $user->getProfile()->getId())
{
return 'post_edit';
}
}
SELECT t1.id, count(t2.id) from table1 t1 inner join table2 t2 on t2.category=t1.id group by t1.id
@develop7
develop7 / bashrc.sh
Created March 25, 2011 22:37 — forked from 228vit/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
# [ -z "$PS1" ] && return
if [[ -n "$PS1" ]]; then ##ну вот же оно! это нужно было раскомментить
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
sfGuardUser:
sfGuardUser_1:
first_name: null
last_name: null
email_address: test@localhost
username: admin
password: "password" #ну да, пароль потом шифруется, и что?
is_active: true
is_super_admin: true
last_login: '2011-04-13 16:48:39'
[2011-05-22 16:06:02] gunzip < /home/andy/.rvm/archives/rubygems-1.8.3.tgz | tar xf - -C /home/andy/.rvm/src
gzip: stdin: not in gzip format
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2011-05-22 16:07:01] gunzip < /home/andy/.rvm/archives/rubygems-1.8.tgz | tar xf - -C /home/andy/.rvm/src
gzip: stdin: not in gzip format
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
@develop7
develop7 / mongo_console.js
Created December 29, 2011 22:56
Thing I've learned today
// way to shoot your own leg
var q = db.some_collection.find({something: "awful"});
q.forEach(function(o) {print(o.foo)}) //this will print something affects map() too
q.forEach(function(o) {print(o.bar)}) //will print nothing
/* because */ q.hasNext() // == false after first call
//right way is to reassign q or don't use it at all
db.some_collection.find({something: "awful"}).forEach(function(o) {print(o.foo)}) //will work
db.some_collection.find({something: "awful"}).forEach(function(o) {print(o.bar)}) //will print stuff too
%  sudo iptables -S > /tmp/before.ipt
%  sudo ufw allow OpenSSH
Rule added
Rule added (v6)
%  sudo iptables -S > /tmp/after.ipt
%  diff -u2 /tmp/before.ipt /tmp/after.ipt
--- /tmp/before.ipt 2012-01-16 22:01:24.675367658 +0300
+++ /tmp/after.ipt 2012-01-16 22:03:40.908253084 +0300
@@ -107,4 +107,5 @@
 -A ufw-user-input -p tcp -m multiport --dports 56882:56889 -j ACCEPT 
#include <stdio.h>
#include <stdlib.h>
typedef struct SStudent{
int id;
char *name;
float percentage;
} TStudent;
int main() {