Skip to content

Instantly share code, notes, and snippets.

View rippo's full-sized avatar

Richard Wilde rippo

View GitHub Profile
select concat('public ',tps.dest,' ',column_name,'{get;set;}') as code
from information_schema.columns c
join(
select 'char' as orign ,'string' as dest union all
select 'varchar' ,'string' union all
select 'longtext' ,'string' union all
select 'datetime' ,'DateTime' union all
select 'text' ,'string' union all
select 'bit' ,'int' union all
select 'bigint' ,'int' union all
@rippo
rippo / loop.casper.js
Created May 5, 2017 09:03
Showing how to loop using casper js
/*eslint strict:0*/
/*global CasperError, console, phantom, require*/
var casper = require("casper").create({
verbose: true
});
// The base links array
var links = [
"http://google.com/",
@rippo
rippo / gist:63fd323964caeb65adcb742d76714bac
Created September 9, 2016 14:40
temp data for shathist
using System.Web.Mvc;
namespace White.Label.Ordering.Infrastructure.Attributes
{
public abstract class ModelStateTempDataTransfer : ActionFilterAttribute
{
protected static readonly string Key = typeof(ModelStateTempDataTransfer).FullName;
}
public class ImportModelStateFromTempData : ModelStateTempDataTransfer
@rippo
rippo / GarberIrish.js
Created May 25, 2016 10:27 — forked from danielgreen/GarberIrish.js
Garber-Irish JavaScript implementation. Provides a way to execute script, on page load, based on the MVC controller and action that produced the page. This is a DOM-routing approach. It can help pages to avoid explicitly referencing numerous JS files. See http://viget.com/inspire/extending-paul-irishs-comprehensive-dom-ready-execution
/* Contains general scripts that may be used in any page.
* If this file starts to get large it can be split into page-specific files. */
/* The following code is the Garber-Irish implementation, a way to run relevant JavaScript on page-load
* based on the MVC action that produced the page. It's an unobtrusive approach, which means that the
* code to call the relevant JavaScript functions is all here instead of being hardcoded into the HTML.
* All this code needs from the page is data-controller and data-action attributes on the body tag.
* Since JavaScript is case-sensitive, the controller and action names we use here must be an exact match.
* http://viget.com/inspire/extending-paul-irishs-comprehensive-dom-ready-execution */
@rippo
rippo / generate.sql
Last active February 15, 2018 15:09
Generate c# clsss from DB table
declare @TableName sysname = 'TableName'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }'
from
(
select
replace(col.name, ' ', '_') ColumnName,
@rippo
rippo / main.jsx
Created July 1, 2015 10:42
two way input box binding with children
var LinkInputs = React.createClass({
getInitialState: function() {
return {input: 0.2};
},
handleChange: function(event) {
console.log('changed parent');
this.setState({ input : event.target.value })
},
@rippo
rippo / main.jsx
Created July 1, 2015 10:19
React linked state with mixin
var Hello = React.createClass({
mixins: [React.addons.LinkedStateMixin],
getInitialState: function() {
return {input: 0.2};
},
render: function() {
var total = this.state.input1 + this.state.input2;
return (
<div>{total}<br/>
@rippo
rippo / GruntFile.js
Created May 20, 2015 14:34
Brackets grunt file to compile React JSX and browserify them into a single app.js file
module.exports = function (grunt) {
grunt.initConfig({
react: {
//event sub/pub test
single_file_output: {
files: {
'mvc/scripts/pages/event.counter.js': 'mvc/scripts/src/jsx/Event.System.Counter.jsx',
@rippo
rippo / dropdown.change.jsx
Last active August 10, 2018 22:04
ReactJS dropdown list example that gets data from a AJAX call with an on change event
var MyParentChange = React.createClass({
getInitialState: function() {
return {
data: [], value: {}, showOutput: false
}
},
componentDidMount: function() {
$.get(this.props.source, function(result) {
var MachineInfo = React.createClass({
getInitialState: function() {
return {
data: []
};
},
componentDidMount: function() {
$.get(this.props.source, function(result) {