Skip to content

Instantly share code, notes, and snippets.

View ttamminen's full-sized avatar

Tatu Tamminen ttamminen

View GitHub Profile
@ttamminen
ttamminen / _paper-curls.scss
Last active December 18, 2015 11:59
Sass mixin to create the paper curls (pure CSS3) effect. The effect was originally introduced by one the following brilliant persons: http://nimbupani.com/drop-shadows-with-css3.html or http://www.matthamm.com/box-shadow-curl.html. Here is an example how the effect will look like: http://blogs.sitepointstatic.com/examples/tech/css3-paper-curl/in…
@mixin paper-curls(
$skew: 5deg,
$rotate: 5deg,
$width: 40%,
$height: 10px)
{
position: relative;
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
@ttamminen
ttamminen / _vertical-divider.scss
Last active December 21, 2015 04:18
Sass mixin to create vertical divider. Divider height will be same as previous container that is set position: relative. Working demo can be found from http://jsfiddle.net/ttamminen/dzHDQ/
@mixin vertical-divider(
$primaryColor: #eee,
$secondaryColor: #aaa,
$dividerWidth: 2px)
{
width: 1px;
height: 1px;
&:after {
content: "";
@ttamminen
ttamminen / _border-radius.scss
Created August 22, 2013 06:30
Sass mixins for common radius cases like rounded top
@mixin border-radius-top($radius: 5px) {
-webkit-border-top-left-radius: $radius;
-webkit-border-top-right-radius: $radius;
-moz-border-radius-topleft: $radius;
-moz-border-radius-topright: $radius;
border-top-left-radius: $radius;
border-top-right-radius: $radius;
}
@mixin border-radius-bottom($radius: 5px) {
C:\gh\my-project-x [master]> npm install
npm WARN prefer global coffee-script@1.9.3 should be installed with -g
> contextify@0.1.14 install C:\gh\my-project-x\node_modules\contextify
> node-gyp rebuild
C:\gh\my-project-x\node_modules\contextify>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
contextify.cc
void Main()
{
var sampleData = new List<Foo>();
sampleData.Add(new Foo { DocumentId = 1, AccessGroupId = 1 });
sampleData.Add(new Foo { DocumentId = 2, AccessGroupId = 1 });
sampleData.Add(new Foo { DocumentId = 3, AccessGroupId = 1 });
sampleData.Add(new Foo { DocumentId = 2, AccessGroupId = 1 });
sampleData.Add(new Foo { DocumentId = 2, AccessGroupId = 1 });
sampleData.Add(new Foo { DocumentId = 2, AccessGroupId = 1 });
@ttamminen
ttamminen / wrapAsyncWorker.ts
Last active July 19, 2019 06:34
Helper function that adds action dispatching to promise
import { AsyncActionCreators } from 'typescript-fsa'
// https://github.com/aikoven/typescript-fsa/issues/5#issuecomment-255347353
function wrapAsyncWorker<TParameters, TSuccess, TError>(
asyncAction: AsyncActionCreators<TParameters, TSuccess, TError>,
worker: (params: TParameters) => Promise<TSuccess>,
) {
return function wrappedWorker(dispatch, params: TParameters): Promise<TSuccess> {
dispatch(asyncAction.started(params));
return worker(params).then(result => {
@ttamminen
ttamminen / AntiForgeryTokenized.tsx
Last active June 8, 2020 06:16
React HOC that provides Anti-Forgery Token to the React component
import * as React from 'react'
import { connect } from 'react-redux'
//
// Higher order component (HOC) to provide Anti-Forgery Token
// to a component that needs to send POST request to a back-end
// controller action that has an attribute [ValidateAntiForgeryTokenHeader]
//
export function AntiForgeryTokenized<P extends WithToken>(
Comp: React.ComponentClass<P> | React.StatelessComponent<P>
@ttamminen
ttamminen / Header.tsx
Last active October 4, 2017 12:33
Fuse-box test material
import * as React from 'react'
import { translate } from 'react-i18next'
import * as classNames from 'classnames'
import { getTranslatedTextIfAvailable } from '../utils/text'
import { LocalizableComponent } from '../constants/types'
export interface HeaderProps extends LocalizableComponent {
text?: string
translationId?: string
@ttamminen
ttamminen / firewall.ps1
Created December 4, 2017 06:02
Set Azure SQL Server firewall using Azure CLI 2.x
$rulename = ''
$servername = ''
$resourcegroup = ''
$currentip = Invoke-WebRequest 'http://ipv4.icanhazip.com' | Select -Expand Content
$currentip = $currentip.Trim()
az sql server firewall-rule delete --name $rulename --resource-group $resourcegroup --server $servername
az sql server firewall-rule create --debug -n $rulename --resource-group $resourcegroup --server $servername --start-ip-address "$currentip" --end-ip-address "$currentip"