Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace CoolProject
{
public class NewViewEngine : RazorViewEngine
public HttpResponseMessage PutGame(int id, Game game)
{
if (ModelState.IsValid && id == game.Id)
{
var g = db.Games.Find(id);
g.InjectFrom(game);
g.ModifyOn = DateTime.Now;
game.InsertOn = DateTime.Now;
try
@andyyou
andyyou / web.config
Created August 1, 2013 02:14
Run woff and some resource on azure
<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
@andyyou
andyyou / upload.js
Created April 15, 2016 00:23 — forked from claudiopetrini/node_upload.js
Node.js file upload on Stamplay
'use strict';
const request = require('request');
const fs = require('fs');
var formData = {
image: fs.createReadStream(__dirname + '/claudio.jpg'),
};
request.post({
@andyyou
andyyou / codepen-with-react.js
Last active September 10, 2016 16:26
codepen-with-react.js
(function() {
function runScripts() {
var bodyScripts = 'body script:not([src])';
var count = 0;
Array.prototype.forEach.call(document.querySelectorAll(bodyScripts), function setJSXType(element) {
if (count++ === 0) {
var res = ["http://fb.me/react-with-addons-0.11.2.js", "http://fb.me/JSXTransformer-0.11.2.js"];
for (r in res) {
var tag = document.createElement('script');
@andyyou
andyyou / react-coverflow.example.js
Last active September 13, 2016 09:09
React Coverflow example
var React = require('react');
var ReactDOM = require('react-dom');
var Coverflow = require('react-coverflow');
var fn = function () {
/* do you want */
}
ReactDOM.render(
<Coverflow
@andyyou
andyyou / react-coverflow-example_2.jsx
Last active September 13, 2016 09:10
react-coverflow support media query
import React from 'react';
import ReactDOM from 'react-dom';
import Coverflow from 'react-coverflow';
import {StyleRoot} from 'radium';
ReactDOM.render(
<StyleRoot>
<Coverflow
displayQuantityOfSide={2}
navigation={true}

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@andyyou
andyyou / Markdium-Shell.sh
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
$ composer require laravel/jetstream
$ php artisan jetstream:install inertia --teams
$ npm install && npm run dev
# (opt) For customize template you should publish these views
$ php artisan vendor:publish --tag=jetstream-views
@andyyou
andyyou / Markdium-Shell.sh
Created October 23, 2020 06:01
Markdium-Laravel 8 - Integrate Jetstream + Socialite in 30 mins
$ createdb demo