Skip to content

Instantly share code, notes, and snippets.

View x1unix's full-sized avatar
:shipit:
Work in progress

Denys Sedchenko x1unix

:shipit:
Work in progress
View GitHub Profile
@x1unix
x1unix / skeleton-daemon.sh
Created April 18, 2016 16:03 — forked from shawnrice/skeleton-daemon.sh
A template to write a quick daemon as a bash script
#!/bin/sh
# This is a skeleton of a bash daemon. To use for yourself, just set the
# daemonName variable and then enter in the commands to run in the doCommands
# function. Modify the variables just below to fit your preference.
daemonName="DAEMON-NAME"
pidDir="."
pidFile="$pidDir/$daemonName.pid"
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"args": [
"--no-color"
],
"tasks": [
{
"taskName": "scripts",
@kogakure
kogakure / gist:4769950
Created February 12, 2013 13:41
SASS: Triangle Mixin
@mixin triangle($width, $dir, $color) {
@if $dir == up {
width: 0;
height: 0;
border-left: $width/2 solid transparent;
border-right: $width/2 solid transparent;
border-bottom: $width/2 solid $color;
} @else if $dir == down {
width: 0;
height: 0;
@addyosmani
addyosmani / Gruntfile_1.js
Last active August 9, 2016 14:26
Gulp comparison examples
module.exports = function(grunt) {
grunt.initConfig({
concat: {
'dist/all.js': ['src/*.js']
},
uglify: {
'dist/all.min.js': ['dist/all.js']
},
jshint: {
files: ['gruntfile.js', 'src/*.js']
@sorenlouv
sorenlouv / range.js
Created December 4, 2015 10:38
Optimized range function for angular
// Extended answer: http://stackoverflow.com/questions/11873570/angularjs-for-loop-with-numbers-ranges/17124017#17124017
// By caching the function result, it can become orders of magnitudes more efficient (depending on how big the range is)
// jsPerf: http://jsperf.com/memoizer-range/9
$scope.range = (function() {
var cache = {};
return function(min, max, step) {
var isCacheUseful = (max - min) > 70;
var cacheKey;
it('should have expandable groups', fakeAsync(() => {
const tbody = fixture.debugElement.query(By.css('tbody'));
const rows = tbody.children;
const rowsInitialCount = tbody.children.length;
// Emit click on first group
tbody.query(By.css('td.events__collapse')).nativeElement.click();
fixture.detectChanges();
tick(1500);
@laracasts
laracasts / test.php
Last active July 10, 2018 16:33
Transactions for functional/integration tests.
<?php
class ExampleTest extends TestCase {
public function setUp()
{
parent::setUp();
DB::beginTransaction();
}
@NathanWalker
NathanWalker / base.component.ts
Created August 30, 2016 16:04
An Angular 2 custom Component decorator which sets ViewEncapsulation.None to all components that use it.
// angular
import {Component, ViewEncapsulation} from '@angular/core';
declare var Reflect: any;
const _reflect: any = Reflect;
// Usage:
// @BaseComponent({ etc... })
export function BaseComponent(metadata: any = {}) {
@yuk7
yuk7 / wslapi_Reg_test.c
Created October 17, 2017 04:18
WSL API Test code for Register Distribution. Windows 10 64bit FCU or later only. I tested with mingw-w64 64bit gcc
#include <stdio.h>
#include <windows.h>
typedef int (WINAPI *FUNC)(PCWSTR,PCWSTR);
int main()
{
HMODULE hmod;
FUNC func;