Skip to content

Instantly share code, notes, and snippets.

View nskeip's full-sized avatar
🕶️

Nikita Hismatov nskeip

🕶️
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 1, 2024 20:58
Minimal APIs at a glance

Это краткая памятка, которая подходит во время вспышки любого респираторного вирусного заболевания. Я ее пишу не для того, чтобы вы срочно начинали все это делать - никакого повода нет. Но, если вы хотите снизить вероятность получения или распространения вирусов - прочитайте.

Общее поведение

  1. Контролируйте свою панику. Никакого повода для паники нет, как говорил человек, падающий с пятого этажа, пролетая мимо четвертого: “пока все нормально”. Напомню, уже на вашей памяти у людей была такая же паника из-за птичьего гриппа и атипичной пневмонии. И никакого зомби-апокалипсиса не произошло. Контролировать панику - значит следить за своими реакциями и стараться принимать решения разумно.
  2. Не осуждайте чужую панику. Это не помогает ни вам, ни паникующим - каждый человек волен паниковать или не паниковать перед лицом любой опасности. Кроме того, активное осуждение паники вокруг “эпидемий” порождает и подпитывает многочисленные теории заговора, так что просто не надо.
  3. Примите разумные меры предосторожно
@rg3915
rg3915 / views.py
Last active September 28, 2023 15:08
Read csv InMemoryUploadedFile Django
import csv
import io
def import_csv(request):
if request.method == 'POST' and request.FILES['myfile']:
myfile = request.FILES['myfile']
# Read csv file InMemoryUploadedFile
file = myfile.read().decode('utf-8')
@eyeced
eyeced / nginx.conf
Created October 26, 2012 11:23
Nginx server configuration with Unicorn for a spree site, running ssl and non-ssl side by side
upstream unicorn {
server unix:/tmp/unicorn.store.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# To enable ssl on your server for checkout and admin functionality
# add this line
listen 443 ssl;
@deanet
deanet / google.sh
Created August 22, 2012 16:09
Uploading File into Google Drive (because grive too many dependencies qt, xorg ? )
#!/bin/bash
## uploading to google
## rev: 22 Aug 2012 16:07
det=`date +%F`
browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1"
username="user@domain-apps.com"
password="password"
accountype="HOSTED" #gooApps = HOSTED , gmail=GOOGLE
<html xmlns:fb="http://ogp.me/ns/fb#">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# oghowto: http://ogp.me/ns/fb/oghowto#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="256521937796214" />
<meta property="og:type" content="oghowto:demo" />
<meta property="og:title" content="Open Graph HowTo" />
<meta property="og:image" content="http://placehold.it/200x200" />
<meta property="og:description" content="Minimum requirements to get Open Graph objects and actions working" />
<meta property="og:url" content="http://oghowto.herokuapp.com/test.html">
<style type="text/css">
@liamdon
liamdon / gist:2467603
Created April 22, 2012 23:53
CoffeeScript, Jade and Stylus syntax highlighting in Sublime Text 2

Step 1: Clone the bundles into your Sublime Text packages directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Step 2: Restart Sublime Text 2

@gudbergur
gudbergur / README.markdown
Created February 19, 2012 23:49
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@AndrewO
AndrewO / gist:1841191
Created February 16, 2012 02:45
PhantomJS code to dump computed styles of all elements and take a screenshot
[url, height, width, output_dir] = phantom.args
console.log("url #{url}, height #{height}, width #{width}, output_dir #{output_dir}")
page = require('webpage').create()
page.viewportSize =
width: width
height: height
page.onConsoleMessage = (msg) ->
@sr75
sr75 / spec_helper.rb
Created February 2, 2012 16:24
Example rails 3.1 spec_helper.rb file using spork, rspec, factory_girl, database_cleaner, I18n
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)