Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / index_by_tag.php
Created November 2, 2014 05:29
how to grab one side of many to many entities in Cake 3
<?php
// I have this in BookmarksController
// I am following the bookmarkr tutorial in http://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/intro.html
/**
* Index view by tag method
*
* @return void
@simkimsia
simkimsia / sent_detect.R
Created November 15, 2014 10:38
sent_detect function using Maxent_Sent_Token_Annotator
sent_detect <- function(text, language) {
# Function to compute sentence annotations using the Apache OpenNLP Maxent sentence detector employing the default model for language 'en'.
sentence_token_annotator <- Maxent_Sent_Token_Annotator(language)
# Convert text to class String from package NLP
text <- as.String(text)
# Sentence boundaries in text
sentence.boundaries <- annotate(text, sentence_token_annotator)
2g1c
2 girls 1 cup
acrotomophilia
anal
anilingus
anus
arsehole
ass
asshole
assmunch
@simkimsia
simkimsia / cake2-gotchas.md
Last active August 29, 2015 14:11
cake2-gotchas.md

Gotchas

JsonView not displaying json string at all

Please ensure that the data is utf-8 encoded.

If data comes from database, ideally add

'encoding' =&gt; 'utf8'
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## see https://vagrantcloud.com/ubuntu/boxes/trusty64
## it should be downloading from https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.33.99"
config.vm.hostname = "djangopythondev"
#Add any alias:
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.1.1 djangopythondev djangopythondev
@simkimsia
simkimsia / install.sh
Last active August 29, 2015 14:13
installing django 1 on ubuntu14.04 server edition
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/41c55e0c08eda42e2cb3/raw/2c87d853643df5942d00ae9ebe87f8cbe1ac39e3/install.sh)" <mysqlPassword>
@simkimsia
simkimsia / install.sh
Last active August 29, 2015 14:15
A better installation script for python django in ubuntu
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/41c55e0c08eda42e2cb3/raw/2c87d853643df5942d00ae9ebe87f8cbe1ac39e3/install.sh)" <mysqlPassword>
@simkimsia
simkimsia / install.sh
Last active August 29, 2015 14:15
Even better installation script for server that will support the django application, the front end and the database for different python environment
#!/bin/bash
###
#
# forked from https://gist.github.com/1264701/08f93534ba177f173b9382b53c419cd0de5b07ea
#
# Ubuntu 14.04 based web server installation script
# Run this by executing the following from a fresh install of Ubuntu 14.04 server:
#
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/simkimsia/41c55e0c08eda42e2cb3/raw/2c87d853643df5942d00ae9ebe87f8cbe1ac39e3/install.sh)" <mysqlPassword>
@simkimsia
simkimsia / browser-test.png
Last active August 29, 2015 14:15
django configs
browser-test.png