Skip to content

Instantly share code, notes, and snippets.

@mreigen
mreigen / app.js
Last active April 10, 2018 17:38
Goal: 1) To remove the # hash from the url. 2) Shareable on Facebook, twitter... with dynamic meta tags
//AngularJS app
.config( function myAppConfig ($locationProvider) {
$locationProvider.html5Mode(true);
...
}
@martani
martani / gist:944963
Created April 27, 2011 19:15
Frequency Analysis on a text (Caesar cipher + key search)
static Dictionary<char, double> AnalyseFrequency(string text)
{
if (text == null)
return null;
Dictionary<char, double> frequencies = new Dictionary<char, double>();
int textLength = text.Length;
for (int i = 0; i < textLength; i++)
{
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { StatisticsService } from './statistics.service';
@Injectable()
export class StatisticsInterceptor implements NestInterceptor {
constructor(
private readonly statisticsService: StatisticsService,
@pheuter
pheuter / gist:3515945
Created August 29, 2012 17:33
Handlebars.js equality check in #if conditional

Handlebars.js is a template framework for Javascript environments. It allows the construction of HTML elements using HTML and expressions wrapped in {{ }}

Limitations of {{if}}

One of the conditional block helpers Handlebars offers is the {{#if}}.

For example:

<div class="entry">
@a-h
a-h / buildspec.yml
Last active November 3, 2022 08:31
Build Go with private dependencies on AWS CodeBuild
version: 0.2
env:
parameter-store:
build_ssh_key: "build_ssh_key"
phases:
install:
commands:
- mkdir -p ~/.ssh
@codedokode
codedokode / задача-сайт-testhub.md
Last active January 24, 2023 14:44
Сайт для тестирования TestHub

Задача

Примечание: раньше тут были другие условия задачи. Их можно найти в предыдущих ревизиях этого задания по ссылке https://gist.github.com/codedokode/8733007/e8e73b0255b3d899cb4e17dc9446fe694a8f5f7c

Cделать сайт TestHub, который позволяет создавать и проходить тесты (с вопросами и ответами). Их могут использовать например, преподаватели для проверки знаний студентов, работодатели для отсеивания кандидатов на вакансию, маркетологи для проведения опросов. Далее мы будем называть того, кто создает тесты, экзаменатором, а того, кто сдает, студентом, это лишь условные названия.

  • Предлагаемые технологии: фреймворк (Symfony 3-4 (сложнее, но интереснее), Yii2, Laravel), MySQL или Postgres, шаблонизатор Twig, ORM Doctrine
  • Время выполнения: все зависит от тебя, но я бы смотрел на 4-6 недель
  • Уровень: очень продвинутый новичок
  • Требуемые знания: PHP, MVC, ООП, HTML/CSS, SQL, основы JS
@DocX
DocX / README.md
Last active September 5, 2023 12:58
Connect to bash inside running ECS container by cluster and service name
@danielgehr
danielgehr / Jenkinsfile
Last active October 30, 2023 02:04
Jenkins pipeline template with environment configuration using gitflow
// ***********************
//
// Build and deploy different environments with jenkins pipeline
//
// Merge to develop -> triggers development release
// Merge to master without tag -> triggers staging release
// Merge to master with tag -> triggers staging and production release
// Production release requires manual approval on the jenkins job
//
// Configure jenkins pipeline project to pull tags! By default, tags are not pulled!
Edit '/etc/sysconfig/jenkins' and add 'prefix=/jenkins' to 'JENKINS_ARGS'
**************************************************************************
JENKINS_ARGS="--prefix=/jenkins"
Comment out the default server config in '/etc/nginx/nginx.conf'
and create following file
'/etc/nginx/conf.d/domain.conf'
*************************************************
@dergachev
dergachev / ubuntu-eol.md
Last active December 7, 2023 22:26
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]