Skip to content

Instantly share code, notes, and snippets.

@VessoVit
VessoVit / funcition.php
Created March 3, 2012 23:43
Wordpress limit excerpt lenght
/* add in function.php */
<?php
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
@VessoVit
VessoVit / FabricDjangoDefault.py
Last active July 30, 2021 12:49 — forked from anonymous/gist:156623
Default script for python/django deployment with Fabric.
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._
Remove recursively a directory. This will wipe all the content in the folder.
###Linux
$ rm -r directory
Change user password
$ passwd username
First time SSH key generation
@VessoVit
VessoVit / Boid
Created November 2, 2013 15:07
simple example of using vectors to hold references to subclasses
class Boid {
};
class First : public Boid {
};
class Second : public Boid {
}
var fs = require('fs');
var js = require('jsonfile'), util = require('util');
//DateTime library
var moment = require('moment');
//Default Date() Node
var date = new Date();
var n = date.toJSON();
//moment library diff test
@VessoVit
VessoVit / RaspiCamTest.js
Created March 24, 2014 10:56
Playing around with Nodejs RaspiCam library
//Camera
var RaspiCam = require("raspicam");
var cam = new RaspiCam({
mode: "video",
w: 320,
h: 280,
b: 1000000,
output: ''
@VessoVit
VessoVit / fb_scrape.rb
Last active August 29, 2015 14:00 — forked from ashaw/fb_scrape.rb
# gem install crack rest-client fastercsv
require 'rubygems'
require 'crack'
require 'rest_client'
require 'csv'
# To use, get an access token here, by clicking "get access token"
# and checking user.groups in the dialog box
# https://developers.facebook.com/tools/explorer?method=GET&path=209024949216061%2Ffeed
#
# Run `ruby fb_scrape.rb ACCESS_TOKEN GROUP_ID`
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `default_schema` ;
USE `default_schema` ;
-- -----------------------------------------------------
-- Table `default_schema`.`ddaUsers`
-- -----------------------------------------------------
@VessoVit
VessoVit / Magic-8.py
Last active August 29, 2015 14:12
Random generator for magic-8 ball...
import random
#1.It is certain
#2.It is decidedly so
#3.Without a doubt
#4.Yes definitely
#5.You may rely on it
#6.As I see it, yes
#7.Most likely
#8.Outlook good
@VessoVit
VessoVit / buildAllExamples.sh
Created April 26, 2015 11:19
Build All Examples OpenFrameworks (OSx)
#!/bin/bash
for category in $( find ../../examples -maxdepth 1 -type d )
do
if [ "$category" = "../../examples/android" -o "$category" = "../../examples/ios" -o "$category" = "../../examples" ]; then
continue
fi
echo "-----------------------------------------------------------------"
echo building ALL examples in $category