Skip to content

Instantly share code, notes, and snippets.

@ifedotov
ifedotov / keybase.md
Created November 20, 2017 22:46
keybase.md

Keybase proof

I hereby claim:

  • I am ifedotov on github.
  • I am ifedotov (https://keybase.io/ifedotov) on keybase.
  • I have a public key ASBcuIVq8_SvaLnuq5eCrQA4vnC8BHVsyrq84et7vmFvdwo

To claim this, I am signing this object:

@ifedotov
ifedotov / keybase.md
Created November 20, 2017 22:43
keybase.md

Keybase proof

I hereby claim:

  • I am ilyafedotov on github.
  • I am ifedotov (https://keybase.io/ifedotov) on keybase.
  • I have a public key ASCbuQWjDYTw5i-or5SfA5vF72A4IvC1qlBmOspBiRgMEgo

To claim this, I am signing this object:

@ifedotov
ifedotov / slug.js
Last active June 16, 2017 18:59
Updated process for making unique slug in Learn Node course by Wes Bos
storeSchema.pre('save', async function(next) {
if (!this.isModified('name')) {
next(); // skip it
return; // stop this function from running
}
var _slug = slug(this.name);
this.slug = _slug;
// find other stores that have a slug of wes, wes-1, wes-2
const slugRegEx = new RegExp(`^(${_slug})((-[0-9]*$)?)$`, 'i');
@ifedotov
ifedotov / result.cfc
Created May 31, 2016 14:06
Parsing responses from eclipse
component name="result"
{
/*
*
* PARSES RESPONSE FROM CONNECTION
*
* */
//CALL parseResult() TO PARSE EACH ROW WITHING THE RETURNED TABLE
private function parseSubTable(connectionResult, fieldName)
@ifedotov
ifedotov / gist:54dae4c460a04956d410
Created January 2, 2015 19:41
Command to map temp directory for git on windows when getting fatal: unable to create temp-file: No such file or directory
export TMPDIR=c:/temp
@ifedotov
ifedotov / Application.cfc
Created October 1, 2014 15:51
Coldfusion ORM 2 one-to-many mappings in place of 1 many-to-many
component
{
this.name = "many_to_many";
this.datasource = "test_mysql";
this.ormenabled = true;
this.ormsettings.dbcreate = "update";
this.ormsettings.flushAtRequestEnd = false;
}
@ifedotov
ifedotov / Person.cfc
Created October 21, 2012 02:52
Person.cfc with ColdFusion ORM settings for many-to-many relationship on same entity
<cfscript>
component output="false" persistent="true" table="Person" {
property name="personid" column="personid" generator="identity" index="true" fieldtype="id" ormtype="int" insert="false" update="false";
property type="timestamp" name="created" generated="insert";
property name="name" ormtype="string";
property
name="guides"
singularname="guide"
fieldtype="many-to-many"
<cffunction name="preProcess" access="public" returntype="void" output="false">
<cfargument name="eventContext" type="MachII.framework.EventContext" required="true" />
<cfscript>
var e = arguments.eventContext.getNextEvent();
var key = makeCacheKey(e);
var cacheData = '';
//get data from cache
if(key neq '') {
<cfscript>
paths = [];
loader = '';
//paths[1] is path to bin-groovy forlder where eclipse puts Groovy .class files
paths[1] = "C:\...\bin-groovy";
//this is where Groovy .jar files are, again you might have different paths
paths[2] = "C:\groovy\groovy-1.6-RC-2\lib\groovy-1.6-RC-2.jar";
paths[3] = "C:\groovy\groovy-1.6-RC-2\lib\asm-2.2.3.jar";
//create the loader
loader = createObject("component", "javaloader.JavaLoader").init(paths);
@ifedotov
ifedotov / collection.cfc
Created February 26, 2011 01:13
Object collection class
<cfcomponent output="false">
<cffunction name="init" access="public" returntype="Collection" output="false">
<cfscript>
variables.container = arrayNew(1);
variables.currentIndex = 0;
return this;
</cfscript>
</cffunction>
<cffunction name="add" access="public" output="false" returntype="void">