Skip to content

Instantly share code, notes, and snippets.

View capan's full-sized avatar

Hüseyin Çapan capan

  • Carbmee
  • Berlin
  • 20:46 (UTC +02:00)
View GitHub Profile
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active June 21, 2023 07:03
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
#!/bin/bash
HOME=/home/ubuntu
APP=$HOME/App
PIDF=$APP/app.pid
CMD=$APP/app.sh
LOG=$HOME/deploy.log
/bin/echo "$(date '+%Y-%m-%d %X'): Initializing Deployment for $APPLICATION_NAME - $DEPLOYMENT_ID " >> $LOG
@bbengfort
bbengfort / balance.py
Created December 7, 2017 02:11
Database transactions blog post.
#!/usr/bin/env python3
import os
import logging
import psycopg2 as pg
from decimal import Decimal
from functools import wraps
from psycopg2.pool import ThreadedConnectionPool
@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active March 23, 2024 09:04
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 15, 2024 22:27
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@rochoa
rochoa / README.md
Last active June 21, 2022 18:42
CARTO Node.js code test

CARTO Node.js code test

Introduction

At CARTO, among other things, we render maps, just check this example of Map with countries and USA states.

In order to limit the scope of the challenge, we are gonna use Mapnik and Node.js. Within this repository, we are providing all the pieces you need to reproduce that map. Well, all pieces except the map tile server.

An example of how to create an image with Mapnik:

@jsanz
jsanz / README.md
Last active August 2, 2017 21:14
CartoDB.js examples: add sublayers

This example shows how to create a Leaflet map with a basemap and an empty CartoDB.js layer. Once the layer is created a function is attached the event of the layers selector checkboxes so on any state change, the sublayers are removed and recreated according to the user selection.

@jsanz
jsanz / README.md
Last active August 8, 2017 10:44 — forked from jorgeas80/app.css
Displayng a raster stored on CartoDB

This example is based on Jorge Arévalo example but using CartoDB.js entirely to interact with the Maps API.

@eabay
eabay / validate-tr-license-plate.coffee
Last active April 14, 2023 15:15
Türkiye plaka kodu için regular expression
validate = (val) ->
# boşluk karakterlerini kaldıralım
v = val.replace(/\s+/g, '').toUpperCase()
# http://tr.wikipedia.org/wiki/Türkiye_il_plaka_kodları adresindeki bilgi kullanılmıştır.
regex = /// ^
(0[1-9]|[1-7][0-9]|8[01]) # İl kodu
(
([A-Z])(\d{4,5}) # "99 X 9999", "99 X 99999"
| ([A-Z]{2})(\d{3,4}) # "99 XX 999", "99 XX 9999"
@kazad
kazad / fourier.html
Created June 25, 2014 19:00
BetterExplained Fourier Example
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="//ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
<!--
TODO: