Skip to content

Instantly share code, notes, and snippets.

@simkimsia
simkimsia / getmonitor.R
Created January 18, 2014 02:51
unable to open the 001.csv file
getmonitor <- function(id, directory, summarize = FALSE) {
path_to_directory = paste(getwd(), directory, sep="/")
temp = list.files(path=path_to_directory, pattern="*.csv")
myfiles = lapply(temp, read.delim)
print(temp)
print(myfiles)
}
print(getwd())
@simkimsia
simkimsia / keep_both_files.php
Last active December 31, 2015 00:09
How to execute the Keep Both Files operation using PHP. Inspired by http://stackoverflow.com/a/14081609/80353
<?php
// you may also use pathinfo
// if the file you want to upload is already in the file directory
// but not in the destination folder
$file_to_upload = 'test.png';
// either way, you definitely need to retrieve the filename and extension
$filename = 'test';
$extension = 'png';
// feel free to change the destination path
$destination_path = dirname(__FILE__);
@simkimsia
simkimsia / composer.json
Created November 27, 2013 08:31
Template for composer.json of CakePHP 2.x plugin
{
"name": "__github-username__/__packagist-package-name__",
"version": "0.1.0",
"description": "",
"type": "cakephp-plugin",
"keywords": [
"cakephp"
],
"homepage": "http://github.com/__github-username__/__PluginName__",
"license": "MIT",
@simkimsia
simkimsia / toc_for_lab1.md
Created November 27, 2013 07:03
the TOC for the nov 27 2013 workshop at hackerspace SG on vagrant + virtualbox + phpunit
@simkimsia
simkimsia / 0_reuse_code.js
Created November 26, 2013 12:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@simkimsia
simkimsia / output
Created November 23, 2013 11:17
code to scrape and count keywords in articles
class(my_df[1,1])
[1] "numeric"
> as.character(my_df[1,1:2])
[1] "0" "0"
@simkimsia
simkimsia / bash.log
Last active December 29, 2015 02:28
heroku logs output
2013-11-22T13:58:22.029004+00:00 app[web.1]: Completed 302 Found in 39ms
2013-11-22T13:58:22.047375+00:00 app[web.1]: Started GET "/admin/content" for 50.19.58.83 at 2013-11-22 13:58:22 +0000
2013-11-22T13:58:22.047375+00:00 app[web.1]:
2013-11-22T13:58:22.047375+00:00 app[web.1]:
2013-11-22T13:58:22.048616+00:00 app[web.1]: Processing by Admin::ContentController#index as
2013-11-22T13:58:22.034986+00:00 heroku[router]: at=info method=POST path=/admin/content/destroy/169 host=mysterious-plateau-7362.herokuapp.com fwd="50.19.58.83" dyno=web.1 connect=2ms service=51ms status=302 bytes=124
2013-11-22T13:58:22.112281+00:00 app[web.1]: Rendered admin/content/_article_list.html.erb (36.9ms)
2013-11-22T13:58:22.123474+00:00 app[web.1]: Completed 200 OK in 75ms (Views: 40.9ms | ActiveRecord: 53.6ms)
2013-11-22T13:58:22.123261+00:00 app[web.1]: Rendered admin/content/index.html.erb within layouts/administration (54.7ms)
2013-11-22T13:58:22.142651+00:00 app[web.1]:
expected "<!DOCTYPE html>\n<html>\n
<head>\n<title>Rotten Potatoes!</title>\n<link href=\"/assets/application.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n<script src=\"/assets/application.js\" type=\"text/javascript\">
</script>\n\n</head>\n<body>\n<h1 class='title'>Rotten Potatoes!</h1>\n<div id='main'>\n<h1>All Movies</h1>\n<form accept-charset=\"UTF-8\" action=\"/movies\" id=\"ratings_form\" method=\"get\"><div style=\"margin:0;padding:0;display:inline\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /></div>\n<input id=\"title_sort\" name=\"title_sort\" type=\"hidden\" value=\"true\" />\n\nInclude:\nG\n<input checked=\"checked\" id=\"ratings_G\" name=\"ratings[G]\" type=\"checkbox\" value=\"1\" />\nPG\n<input checked=\"checked\" id=\"ratings_PG\" name=\"ratings[PG]\" type=\"checkbox\" value=\"1\" />\nPG-13\n<input checked=\"checked\" id=\"ratings_PG-13\" name=\"ratings[PG-13]\" type=\"checkbox\" value=\"1\" />\nNC-17\n<input checked=\"checked\" id=\"ratings_
@simkimsia
simkimsia / .travis.yml
Created November 17, 2013 14:43
Latest Travis configuration for CakePHP Plugin. Replace {PluginName} accordingly.
language: php
php:
- 5.4
- 5.5
env:
global:
- PLUGIN_NAME={PluginName}
- REQUIRE=""
@simkimsia
simkimsia / UserFixture.php
Created November 16, 2013 07:13
Example to demonstrate the template in https://gist.github.com/simkimsia/7497019
<?php
/**
* UserFixture
*
* Fixtures for a User model that belongsTo Group as the relationship Group
*
* Copyright 2013, Kim Stacks
* Singapore
*
* Licensed under The MIT License