Skip to content

Instantly share code, notes, and snippets.

View ilyazub's full-sized avatar
🇺🇦

ilyazub

🇺🇦
View GitHub Profile
@Ajedi32
Ajedi32 / .bashrc
Created May 1, 2013 16:15
Add this to your `~/.bashrc` file to enable the use of the `subl` command on your Git Bash prompt on Windows. (It may work with other shells as well, but I've only tested this with Git Bash on Windows and bash on Ubuntu.) Note that this command not only supports file input, but also simulates support for piped input as well. ``` Usage: subl file…
# Enable the use of the `subl` command
subl () {
subl_path='C:\Program Files\Sublime Text 2\sublime_text.exe'
if test -t 0
then
"$subl_path" $*
else
timestamp=`date +%s`
filename=$1
shift
@abaird
abaird / output.txt
Last active January 3, 2020 09:54
Run tests with RSpec formatter in Rake task
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['--format html', '--out spec/reports/results.html']
t.pattern = 'spec/heartbeat/heartbeat_spec.rb'
end
task :clean do
rm_rf 'spec/reports'
@manfe
manfe / helper.rb
Last active January 14, 2020 10:15
Rails Helper to build Hierachical HTML List
module TreeListHelper
# the collection need to be the root parents
def tree_list(collection)
content_tag(:ul) do
collection.each do |item|
if item.children.any?
concat(
content_tag(:li, id: item.id) do
concat(item.name)
concat(tree_list(item.children))
@chriseppstein
chriseppstein / _icons.scss
Created December 5, 2010 21:48
This is an example of the generated stylesheet by compass for a set of sprites
@import "compass/utilities/sprites/base";
// General Sprite Defaults
// You can override them before you import this file.
$icon-sprite-base-class: ".icon-sprite" !default;
$icon-sprite-dimensions: false !default;
$icon-position: 0% !default;
$icon-spacing: 0 !default;
$icon-repeat: no-repeat !default;
@rattrayalex
rattrayalex / MessageStore_FluxBone.js
Last active June 19, 2020 09:40
Flux and Backbone
var ChatAppDispatcher = require('../dispatcher/ChatAppDispatcher');
var ChatConstants = require('../constants/ChatConstants');
var ChatMessageUtils = require('../utils/ChatMessageUtils');
var EventEmitter = require('events').EventEmitter;
var ThreadStore = require('../stores/ThreadStore');
var merge = require('react/lib/merge');
var ActionTypes = ChatConstants.ActionTypes;
var CHANGE_EVENT = 'change';
@ibrahima
ibrahima / CodeBlock.jsx
Last active December 3, 2020 10:23
Syntax highlighting for react-markdown
import React from 'react';
import PropTypes from 'prop-types';
import SyntaxHighlighter from 'react-syntax-highlighter';
export default class CodeBlock extends React.PureComponent {
static propTypes = {
value: PropTypes.string.isRequired,
language: PropTypes.string,
}
@vasi
vasi / fib.rb
Created January 28, 2018 10:30
Dumbest fibonacci ever
#!/usr/bin/env ruby
def fib0(a)
0.upto(a.size-1) { |i| a[i] += 1 }
end
def fib1(a)
fib0(a)
end
@dimkir
dimkir / nightmare-on-amazon-linux.MD
Last active February 6, 2021 17:45
How to run nightmare on Amazon Linux

Running nightmare on Amazon Linux

You may have thought of running nightmare on AWS Lambda. But before we can run it on Lambda, we need first to make it run on Amazon Linux.

Provision instance which replicates Lambda environment

According to AWS Documentation on Lambda Execution Environment and available Libraries we would need this AMI image with this alias amzn-ami-hvm-2016.03.3.x86_64-gp2. Keep in mind that AMI-image-id for this instance would be different in different regions (eg):

  • In eu-west-1 - ami-f9dd458a
  • In us-east-1 - ami-6869aa05
<img class="slideshow__image slideshow__image--{{ block.id }} lazyload"
src="{{ block.settings.image | img_url: '300x' }}"
data-src="{{ img_url }}"
data-widths="[540, 720, 900, 1080, 1296, 1512, 1728, 1944, 2048]"
data-aspectratio="{{ block.settings.image.aspect_ratio }}"
data-sizes="auto"
data-parent-fit="cover"
alt="{{ block.settings.image.alt | escape }}">
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as: